@fun-eat/design-system v0.4.3
๐ฅ ํ์ํ ๋์์ธ์์คํ ๐จ
Install
npm
npm install @fun-eat/design-system
yarn
yarn add @fun-eat/design-system
FunEatProvider
@fun-eat/design-system
์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด์๋ FunEatProvider๋ก ๊ฐ์ธ์ค์ผํฉ๋๋ค.
//index.tsx
import FunEatProvider from '@fun-eat/design-system';
<FunEatProvider>
<App />
</FunEatProvider>;
Components
Badge
์์ ํฌ๊ธฐ์ ๋ฑ์ง ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
element | p, span(default: span) | Badge ์ปดํฌ๋ํธ์ element ํ์ ์ ๋๋ค. |
color | CSSProperties'color' | Badge ์ปดํฌ๋ํธ ๋ด๋ถ ์์์ ๋๋ค. |
textColor | CSSProperties'color' | Badge ์ปดํฌ๋ํธ์ ๋ค์ด๊ฐ ํ ์คํธ์ ์์์ ๋๋ค. |
size? | xs, sm, md, lg, xl (default: sm) | Badge ์ปดํฌ๋ํธ์ ๋ค์ด๊ฐ ํ ์คํธ์ ํฌ๊ธฐ์ ๋๋ค. |
css? | CSSProp | Badge ์ปดํฌ๋ํธ์ ์ ์ฉํ CSS ์คํ์ผ์ ๋๋ค. |
Example
<Badge color="#000" textColor="#fff" size="md">๋ฑ์ง</Badge>
<Badge color="#000" textColor="#fff">๋ฑ์ง</Badge>
BottomSheet
์๋์์ ์๋ก ์ฌ๋ผ์ค๋ ๋ฐํ ์ํธ ์ปดํฌ๋ํธ์ ๋๋ค.
@fun-eat/design-system์์ ์ ๊ณตํ๋ useBottomSheet์ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
Props
props | value | description |
---|---|---|
maxWidth? | string | BottomSheet ์ปดํฌ๋ํธ์ ์ต๋ ํญ์ ๋๋ค. |
isClosing | boolean | BottomSheet ์ปดํฌ๋ํธ๊ฐ ๋ซํ๋์ง ์ฌ๋ถ์ ๋๋ค. |
close() | function | BottomSheet ์ปดํฌ๋ํธ๋ฅผ ๋ซ๋ ํจ์๋ฅผ ์ ๋ฌํฉ๋๋ค. |
Example
import { useBottomSheet } from '@fun-eat/design-system';
const Parent = () => {
const { ref, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet();
return (
<>
<button type="button" onClick={handleOpenBottomSheet}>
๋ฐํ
์ํธ ์ด๊ธฐ
</button>
<BottomSheet ref={ref} isClosing={isClosing} close={handleCloseBottomSheet}>
<div>๋ฐํ
์ํธ ์ปดํฌ๋ํธ</div>
</BottomSheet>
</>
);
};
Button
๋ฒํผ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
customWidth? | string (default: 120px) | Button ์ปดํฌ๋ํธ์ ๋์ด์ ๋๋ค. |
customHeight? | string (default: 40px) | Button ์ปดํฌ๋ํธ์ ๋์ด์ ๋๋ค. |
color? | color (default: primary) | Button ์ปดํฌ๋ํธ์ ์์์ ๋๋ค. |
textColor? | color (default: default) | Button ์ปดํฌ๋ํธ์ ํ ์คํธ ์์์ ๋๋ค. |
size? | xs, sm, md, lg, xl (default: md) | Button ์ปดํฌ๋ํธ์ ํฐํธ ํฌ๊ธฐ์ ๋๋ค. |
weight? | light, regular, bold (default: bold) | Button ์ปดํฌ๋ํธ์ ํฐํธ ๊ฐ์ค์น์ ๋๋ค. |
variant? | outlined, filled, transparent (default: filled) | Button ์ปดํฌ๋ํธ์ ์คํ์ผ๋ก ๋ฐฐ๊ฒฝ์ ์์ด ์์๋ผ์ธ์ด ์๋์ง, ๋ฐฐ๊ฒฝ์์ด ์๊ณ ์์๋ผ์ธ์ด ์๋์ง, ํฌ๋ช ๋ฐฐ๊ฒฝ์ธ์ง ์ค์ ํ ์ ์์ต๋๋ค. |
css? | CSSProp | Button ์ปดํฌ๋ํธ์ ์ ์ฉํ CSS ์คํ์ผ์ ๋๋ค. |
Example
<Button width="100%" height="20px" color="#000" textColor="#fff" size="sm" weight="regular" variant="filled">๋ฒํผ</Button>
<Button>๋ฒํผ</Button>
Carousel
์บ๋ฌ์ ์ปดํฌ๋ํธ์ ๋๋ค.
Example
const carouselList = [0, 1, 2].map((index) => ({
id: index,
children: <div>{index}</div>,
}));
<Carousel carouselList={carouselList} />;
Checkbox
์ฒดํฌ๋ฐ์ค ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
size? | xs, sm, md, lg, xl (default: md) | Checkbox ์ปดํฌ๋ํธ์ ์ฒดํฌ๋ฐ์ค ํฌ๊ธฐ์ ๋๋ค. |
fontSize? | xs, sm, md, lg, xl (default: md) | Checkbox ์ปดํฌ๋ํธ์ ํฐํธ ํฌ๊ธฐ์ ๋๋ค. |
weight? | light, regular, bold (default: bold) | Checkbox ์ปดํฌ๋ํธ์ ํฐํธ ๊ฐ์ค์น์ ๋๋ค. |
tabIndex? | -1,ย 0,ย 1 | Checkbox ์ปดํฌ๋ํธ์ tabIndex์ ๋๋ค. |
Example
<Checkbox />
<Checkbox size="xs">์ฌ๊ตฌ๋งค ์์ฌ๊ฐ ์์ผ์ ๊ฐ์?</Checkbox>
<Checkbox size="xl" fontSize="xl" weight="bold">์ฌ๊ตฌ๋งค ์์ฌ๊ฐ ์์ผ์ ๊ฐ์?</Checkbox>
Divider
ํ๋ฉด ๊ตฌ์ญ์ ๋๋๋ ์ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
variant? | default , strong , disabled (default: default) | Divider ์ปดํฌ๋ํธ์ ์ข ๋ฅ์ ๋๋ค. ๊ฐ์กฐ์ ์ ๋ ์ฐจ์ด๊ฐ ์์ต๋๋ค. |
customWidth? | string (default: 100%) | Divider ์ปดํฌ๋ํธ์ ๊ธธ์ด์ ๋๋ค. |
customHeight? | string (default: 1px) | Divider ์ปดํฌ๋ํธ์ ๋๊ป์ ๋๋ค. |
css? | CSSProp | Divider ์ปดํฌ๋ํธ์ ์ ์ฉํ CSS ์คํ์ผ์ ๋๋ค. |
Example
<Divider variant="strong" customWidth="50%" customHeight='4px' />
<Divider />
Heading
HTML heading ํ๊ทธ๋ฅผ ์ฌ์ฉํ๋ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
children? | ReactNode | Heading ์ปดํฌ๋ํธ์ ์์ ์ปดํฌ๋ํธ์ ๋๋ค. |
as? | h1 ,h2, h3(default: h1) | Heading ์ปดํฌ๋ํธ์ HTML ํ๊ทธ์ ๋๋ค. |
size? | xs,ย sm,ย md,ย lg,ย xl | Heading ์ปดํฌ๋ํธ์ ํฐํธ ํฌ๊ธฐ์ ๋๋ค. |
weight? | light,ย regular,ย bold | Heading ์ปดํฌ๋ํธ์ ํฐํธ ๊ฐ์ค์น์ ๋๋ค. |
css? | CSSProp | Heading ์ปดํฌ๋ํธ์ ์ ์ฉํ CSS ์คํ์ผ์ ๋๋ค. |
Example
<Heading>๋ก๋ง์ค์ฐํํดํฉ</Heading>
<Heading as="h2">๋ก๋ง์ค์ฐํํดํฉ</Heading>
<Heading as="h3" size="xl" weight='regular'>๋ก๋ง์ค์ฐํํดํฉ</Heading>
<Heading as="h3" css='color: red;'>๋ก๋ง์ค์ฐํํดํฉ</Heading>
Input
์ธํ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
customWidth? | string | Input ์ปดํฌ๋ํธ์ ๋๋น๊ฐ์ ๋๋ค. |
minWidth? | string | Input ์ปดํฌ๋ํธ์ ์ต์ ๋๋น๊ฐ์ ๋๋ค. |
isError? | boolean | Input value์ ์๋ฌ๊ฐ ์๋์ง ์ฌ๋ถ์ ๋๋ค. |
rightIcon? | ReactNode | Input ์ปดํฌ๋ํธ ์ค๋ฅธ์ชฝ์ ์์นํ ์์ด์ฝ์ ๋๋ค. |
errorMessage? | string | isError๊ฐ true์ผ ๋ ๋ณด์ฌ์ค ์๋ฌ ๋ฉ์์ง์ ๋๋ค. |
Example
<Input
customWidth="100%"
onChange={modifyNickname}
/>
<Input
customWidth="100%"
rightIcon={
<Button customHeight="36px" color="white">
<SvgIcon variant="search" />
</Button>
}
/>
Link
๋ค๋ฅธ URL๋ก ์ฐ๊ฒฐํ๋ ์ปดํฌ๋ํธ์
๋๋ค.ย react-router-dom
๊ณผ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค.
Props
props | value | description |
---|---|---|
as? | a, Link(react-router-dom์ Link),ย NavLink(react-router-dom์ NavLink) (default:ย a) | Link ์ปดํฌ๋ํธ๋ก ์ฌ์ฉํ HTML ํ๊ทธ ๋๋ ์ธ๋ถ ๋งํฌ ์ปดํฌ๋ํธ์ ๋๋ค. |
isExternal? | boolean (default: false) | Link ์ปดํฌ๋ํธ์ ๋งํฌ ํด๋ฆญ ์ ์๋ก์ด ํญ์ผ๋ก ์ด๋๋ก ์ ํํ ์ ์์ต๋๋ค. |
block | boolean (default: false) | Link ์ปดํฌ๋ํธ์ ๋์คํ๋ ์ด ์์ฑ์ด block์ธ์ง ์ ํํ ์ ์์ต๋๋ค. |
css? | CSSProp | Link ์ปดํฌ๋ํธ์ ์ ์ฉํ CSS ์คํ์ผ์ ๋๋ค. |
Example
<Link href='#'>๋งํฌ๋ก ์ด๋ํฉ๋๋ค.</Link>
<Link href='#' isExternal></Link>
<Link href='#' isExternal block>๋งํฌ๋ก ์ด๋ํฉ๋๋ค.</Link>
// react-router-dom์ ์ฌ์ฉํ ์์
import {Link as RouterLink, NavLink} from 'react-router-dom'
<Link as={RouterLink} to='/'>๋งํฌ๋ก ์ด๋ํฉ๋๋ค.</Link>
<Link as={NavLink} to='/' isExternal>๋งํฌ๋ก ์ด๋ํฉ๋๋ค.</Link>
Skeleton
๋ก๋ฉ ์ํ๋ฅผ ์๊ฐ์ ์ผ๋ก ๋ํ๋ด๋ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
width? | string , number | Skeleton ์ปดํฌ๋ํธ์ ๋๋น๊ฐ์ ๋๋ค. |
height? | string , number | Skeleton ์ปดํฌ๋ํธ์ ๋์ด๊ฐ์ ๋๋ค. |
Example
<Skeleton width={90} height={90} />
Spacing
ํ๋ฉด ๊ตฌ์ญ์ ๋๋๋ ์ฌ๋ฐฑ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
direction? | vertical, horizontal (default: vertical) | Spacing ์ปดํฌ๋ํธ์ ๋ฐฉํฅ์ ๋๋ค. |
size | number | Spacing ์ปดํฌ๋ํธ์ ํฌ๊ธฐ์ ๋๋ค. |
Example
<Spacing size={10} />
<Spacing direction="horizontal" size={10} />
Text
ํ ์คํธ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
children? | ReactNode | Text ์ปดํฌ๋ํธ์ ์์ ์ปดํฌ๋ํธ์ ๋๋ค. |
as? | p, span (default: p) | Text ์ปดํฌ๋ํธ์ HTML ํ๊ทธ์ ๋๋ค. |
size? | xs, sm, md, lg, xl (default: md) | Text ์ปดํฌ๋ํธ์ ํฐํธ ํฌ๊ธฐ์ ๋๋ค. |
weight? | light, regular, bold(default: regular) | Text ์ปดํฌ๋ํธ์ ํฐํธ ๊ฐ์ค์น์ ๋๋ค. |
lineHeight? | xs, sm, md, lg, xl(default: md) | Text ์ปดํฌ๋ํธ์ ํ ์คํธ ๋์ด์ ๋๋ค. |
color? | CSSProperties'color' (default: โ#232527โ) | Text ์ปดํฌ๋ํธ์ ํ ์คํธ ์์์ ๋๋ค. |
align? | left, center, right (default: left) | Text ์ปดํฌ๋ํธ์ ํ ์คํธ ์ ๋ ฌ์ ๋๋ค. |
css? | CSSProp | Text ์ปดํฌ๋ํธ์ ์ ์ฉํ CSS ์คํ์ผ์ ๋๋ค. |
Example
<Text>๋ก๋ง์ค์ฐํํดํฉ</Text>
<Text as="span">๋ก๋ง์ค์ฐํํดํฉ</Text>
<Text weight="bold" size="xl">๋ก๋ง์ค์ฐํํดํฉ</Text>
<Text css="color: red;">๋ก๋ง์ค์ฐํํดํฉ</Text>
Textarea
๋ฉํฐ๋ผ์ธ ํ ์คํธ ์ ๋ ฅ ์ปดํฌ๋ํธ์ ๋๋ค.
Props
props | value | description |
---|---|---|
resize? | both,ย horizontal,ย vertical,ย none (default:ย both) | Textarea ์ปดํฌ๋ํธ์ ํฌ๊ธฐ ์ฌ์กฐ์ ๋ฐฉํฅ ์ค์ ์ ๋๋ค. |
errorMessage? | string | Textarea ์ปดํฌ๋ํธ์ ์๋ฌ ๋ฉ์์ง์ ๋๋ค. |
Example
<Textarea />
<Textarea resize="vertical" rows={10} placeholder="๊ฐ์ ์
๋ ฅํด์ฃผ์ธ์."/>
Toast
์๋์ ๋์ฐ๋ ํ ์คํธ ์ปดํฌ๋ํธ์ ๋๋ค.
Example
const { toast } = useToastActionContext();
toast.success('์ฑ๊ณต');
toast.error('์คํจ');
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago