Skip to content

Commit

Permalink
Add new FancyMiniContentCard components
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTRy committed Dec 23, 2023
1 parent 84da274 commit b13eb1c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/Routes/ExperimentalRoute/ExperimentalRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ export default function ExperimentalRoute() {

return (
<>
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
<FancyMiniContentCard size="sm" title="Test klkfkl dlfklkfdklfd " symbol={Icon} />
<FancyMiniContentCard size="md" title="Test kkdfk jkjkjkdf" symbol={Icon} />
<FancyMiniContentCard size="lg" title="Test kdlkdfklfdkl klkl" symbol={Icon} />
</div>
<DesignWrapper>
<DesignArea title="Test">
<FancyMiniContentCard size="sm" title="Test" symbol={Icon} />
<FancyMiniContentCard size="md" title="Test" symbol={Icon} />
<FancyMiniContentCard size="lg" title="Test" symbol={Icon} />
<FancyCard>
<FancyContent flexDirection="column" flexJustify="center">
<FancyContent.Icon size="xl">
Expand Down
7 changes: 6 additions & 1 deletion src/components/atoms/FancyCard/FancyCard.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ type IStyledCard = IStyledPrefixAndOmiter<StyledCardProps>;
//the main design of the card
export const StyledCard = styled(FancyBox)<IStyledCard & { theme: TTheme }>`
display: inline-block;
overflow: hidden;
box-sizing: border-box;
aspect-ratio: 1/1;
padding: ${({ $padding, $size = 'md', theme }) => ($padding ? theme.spacing[sizeSettings[$size].padding] : '')};
border-radius: ${({ $roundedEdges }) => ($roundedEdges ? edgeCalculation($roundedEdges) : '')};
${({ $shadow }) => $shadow && boxShadow.sm};
`;

export const InnerCard = styled.div`
width: 100%;
height: 100%;
`;
4 changes: 2 additions & 2 deletions src/components/atoms/FancyCard/FancyCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StyledCard } from './FancyCard.style';
import { InnerCard, StyledCard } from './FancyCard.style';
import { IFancyBox } from '@/components/atoms/FancyBox/';
import { StyledCardProps } from '@/components/atoms/FancyCard/Card.model';

Expand All @@ -21,7 +21,7 @@ export default function FancyCard(props: ICard) {

return (
<StyledCard $size={size} $padding={padding} $roundedEdges={roundedEdges} $shadow={shadow} {...fancyBox}>
{children}
<InnerCard>{children}</InnerCard>
</StyledCard>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { styled } from 'styled-components';

import { FancyCard } from '@/components/atoms/FancyCard';
import { sizeSettings } from './sizeSettings';
import { TFancyMiniContentCardProps } from './FancyMiniContentCard';
import IStyledPrefixAndPicker from '@/interface/IStyledPrefixAndPicker';

type IStyledCard = IStyledPrefixAndPicker<TFancyMiniContentCardProps, 'size'>;
export const StyledCard = styled(FancyCard)<IStyledCard>`
aspect-ratio: 1/1;
width: ${({ $size = 'md' }) => sizeSettings[$size].size};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ export type TFancyMiniContentCardProps = {
};

export default function FancyMiniContentCard(props: TFancyMiniContentCardProps) {
const { size } = props;
const { size, title, description } = props;
return (
<StyledCard $size={size}>
<FancyFlexBox flexDirection="column" flexAlign="center" flexJustify="center" fitBox>
<FancySVGAtom size="xl">{props.symbol}</FancySVGAtom>

<Typography type="h4">Moooiin</Typography>
<Typography type="content">Moooiin</Typography>
<Typography type="h4">{title}</Typography>
<Typography type="content">{description}</Typography>
</FancyFlexBox>
</StyledCard>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const sizeSettings = {
borderRadius: 'lg',
},
lg: {
size: globalSizes.lg.elementSize,
size: globalSizes.xxl.elementSize,
padding: 'xl',
borderRadius: 'xl',
},
Expand Down

0 comments on commit b13eb1c

Please sign in to comment.