-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui/react/components): card 관련 컴포넌트들 추가 (#170)
* feat(ui/react/components/card): Card 컴포넌트 관련 style 추가 * feat(ui/react/components/card): CardBody 컴포넌트 관련 style 추가 * feat(ui/react/components/card): CardFooter 컴포넌트 관련 style 추가 * feat(ui/react/components/card): CardHeader 컴포넌트 관련 style 추가 * feat(ui/react/components/card): Card 컴포넌트 추가 * feat(ui/react/components/card): CardHeader 컴포넌트 추가 * feat(ui/react/components/card): CardBody 컴포넌트 추가 * feat(ui/react/components/card): CardFooter 컴포넌트 추가 * feat(ui/react/components/card): card 관련 컴포넌트들을 모은 index.ts 추가 * feat(ui/react/components/index.ts): card 추가
- Loading branch information
Showing
10 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/ui/react/src/components/card/card-body.styles.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const cardBodyBase = style({ | ||
flex: '1 1 0%', | ||
padding: 16, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { | ||
type HTMLFavolinkProps, | ||
favolink, | ||
forwardRef, | ||
} from '@favolink-ui/system'; | ||
import { cx } from '@favolink-ui/utils'; | ||
import * as styles from './card-body.styles.css'; | ||
|
||
export type CardBodyProps = HTMLFavolinkProps<'section'>; | ||
|
||
export const CardBody = forwardRef<CardBodyProps, 'section'>( | ||
function CardBody(props, ref) { | ||
const { children, className, ...restProps } = props; | ||
|
||
return ( | ||
<favolink.section | ||
{...restProps} | ||
ref={ref} | ||
className={cx('favolink-card__body', styles.cardBodyBase, className)} | ||
> | ||
{children} | ||
</favolink.section> | ||
); | ||
}, | ||
); |
8 changes: 8 additions & 0 deletions
8
packages/ui/react/src/components/card/card-footer.styles.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
import { flexStyleVars } from '../../styles'; | ||
|
||
export const cardFooterBase = style({ | ||
padding: 16, | ||
display: 'flex', | ||
justifyContent: flexStyleVars.justifyContent, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { assignInlineVars } from '@vanilla-extract/dynamic'; | ||
import { | ||
type HTMLFavolinkProps, | ||
favolink, | ||
forwardRef, | ||
} from '@favolink-ui/system'; | ||
import { cx } from '@favolink-ui/utils'; | ||
import * as styles from './card-footer.styles.css'; | ||
import { type FlexStyleProps, flexStyleVars } from '../../styles'; | ||
|
||
type CardFooterStyleProps = Pick<FlexStyleProps, 'justifyContent'>; | ||
|
||
export type CardFooterProps = CardFooterStyleProps & | ||
HTMLFavolinkProps<'footer'>; | ||
|
||
export const CardFooter = forwardRef<CardFooterProps, 'footer'>( | ||
function CardFooter(props, ref) { | ||
const { className, style, children, justifyContent, ...restProps } = props; | ||
|
||
return ( | ||
<favolink.footer | ||
{...restProps} | ||
ref={ref} | ||
className={cx( | ||
'favolink-card__footer', | ||
styles.cardFooterBase, | ||
className, | ||
)} | ||
style={{ | ||
...assignInlineVars({ | ||
[flexStyleVars.justifyContent]: justifyContent, | ||
}), | ||
...style, | ||
}} | ||
> | ||
{children} | ||
</favolink.footer> | ||
); | ||
}, | ||
); |
5 changes: 5 additions & 0 deletions
5
packages/ui/react/src/components/card/card-header.styles.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const cardHeaderBase = style({ | ||
padding: 16, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
type HTMLFavolinkProps, | ||
favolink, | ||
forwardRef, | ||
} from '@favolink-ui/system'; | ||
import { cx } from '@favolink-ui/utils'; | ||
import * as styles from './card-header.styles.css'; | ||
|
||
export type CardHeaderProps = HTMLFavolinkProps<'header'>; | ||
|
||
export const CardHeader = forwardRef<CardHeaderProps, 'header'>( | ||
function CardHeader(props, ref) { | ||
const { children, className, ...restProps } = props; | ||
|
||
return ( | ||
<favolink.header | ||
{...restProps} | ||
ref={ref} | ||
className={cx( | ||
'favolink-card__header', | ||
styles.cardHeaderBase, | ||
className, | ||
)} | ||
> | ||
{children} | ||
</favolink.header> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
import { flexStyleVars } from '../../styles'; | ||
|
||
export const cardBase = style({ | ||
minWidth: 0, | ||
maxWidth: 310, | ||
borderRadius: 12, | ||
position: 'relative', | ||
display: 'flex', | ||
justifyContent: flexStyleVars.justifyContent, | ||
alignItems: flexStyleVars.alignItems, | ||
flexDirection: flexStyleVars.flexDirection, | ||
boxShadow: | ||
'0 1px 10px 0 rgba(211, 214, 224, 0.25), 0 1px 10px 0 rgba(211, 214, 224, 0.25)', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { assignInlineVars } from '@vanilla-extract/dynamic'; | ||
import { | ||
type HTMLFavolinkProps, | ||
extractProps, | ||
favolink, | ||
forwardRef, | ||
} from '@favolink-ui/system'; | ||
import { cx } from '@favolink-ui/utils'; | ||
import * as styles from './card.styles.css'; | ||
import { | ||
type FlexStyleProps, | ||
flexStyleProps, | ||
flexStyleVars, | ||
} from '../../styles'; | ||
|
||
type CardStyleProps = Pick< | ||
FlexStyleProps, | ||
'alignItems' | 'flexDirection' | 'justifyContent' | ||
>; | ||
|
||
export type CardProps = CardStyleProps & HTMLFavolinkProps<'article'>; | ||
|
||
export const Card = forwardRef<CardProps, 'article'>(function Card(props, ref) { | ||
const { flexDirection = 'column', ...restProps } = props; | ||
const { children, className, style, ..._restProps } = extractProps( | ||
restProps, | ||
flexStyleVars, | ||
flexStyleProps, | ||
); | ||
|
||
return ( | ||
<favolink.article | ||
{..._restProps} | ||
ref={ref} | ||
className={cx('favolink-card', styles.cardBase, className)} | ||
style={{ | ||
...assignInlineVars({ | ||
[flexStyleVars.flexDirection]: flexDirection, | ||
}), | ||
...style, | ||
}} | ||
> | ||
{children} | ||
</favolink.article> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* eslint-disable @stylistic/padding-line-between-statements, react-refresh/only-export-components */ | ||
export { Card, type CardProps } from './card'; | ||
export { CardBody, type CardBodyProps } from './card-body'; | ||
export { CardFooter, type CardFooterProps } from './card-footer'; | ||
export { CardHeader, type CardHeaderProps } from './card-header'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters