Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
fix(card): removed banner component and combined the feature in the c…
Browse files Browse the repository at this point in the history
…ard component
  • Loading branch information
fritzschoff committed Mar 30, 2022
1 parent 39bed4b commit ae40fab
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 81 deletions.
32 changes: 0 additions & 32 deletions src/components/Banner.tsx

This file was deleted.

60 changes: 39 additions & 21 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,53 @@ import styled from 'styled-components';
import colors from '../styles/colors';

interface CardProps {
withGradientWrapper?: boolean;
withBorderGradient?: boolean;
withBackgroundGradientColor?: keyof typeof colors;
}

export default function Card({
withGradientWrapper,
children,
withBorderGradient,
withBackgroundGradientColor,
children,
}: PropsWithChildren<CardProps>) {
if (withGradientWrapper) {
return (
<StyledGradientWrapper>
<StyledCard>{children}</StyledCard>
</StyledGradientWrapper>
);
}
return <StyledCard>{children}</StyledCard>;
if (withBorderGradient) {
return (
<StyledGradientWrapper>
<StyledCard>{children}</StyledCard>
</StyledGradientWrapper>
);
}
if (withBackgroundGradientColor) {
return (
<StyledBackgroundGradientWrapper color={withBackgroundGradientColor}>
<StyledCard className="darker-40">{children}</StyledCard>
</StyledBackgroundGradientWrapper>
);
}
return <StyledCard>{children}</StyledCard>;
}

const StyledGradientWrapper = styled.div`
width: 100%;
height: 100%;
border-radius: 5px;
background: ${colors.gradients.rainbow};
padding: 2px;
border-radius: 4px;
width: 100%;
height: 100%;
border-radius: 5px;
background: ${colors.gradients.rainbow};
padding: 2px;
border-radius: 4px;
`;

const StyledBackgroundGradientWrapper = styled.div<{ color: keyof typeof colors }>`
width: 100%;
height: 100%;
border-radius: 5px;
background: ${({ color }) => colors[color]};
padding: 2px;
border-radius: 4px;
`;

const StyledCard = styled.div`
width: 100%;
height: 100%;
background-color: ${colors.backgroundColor};
border-radius: 4px;
width: 100%;
height: 100%;
background-color: ${colors.backgroundColor};
border-radius: 4px;
`;
1 change: 0 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export { default as Selector } from './Selector';
export { default as Dropdown } from './Dropdown';
export { default as Card } from './Card';
export { default as Carousel } from './Carousel';
export { default as Banner } from './Banner';
27 changes: 0 additions & 27 deletions src/stories/Banner.stories.tsx

This file was deleted.

0 comments on commit ae40fab

Please sign in to comment.