-
Notifications
You must be signed in to change notification settings - Fork 0
๐ ์ฝ๋ ์ปจ๋ฒค์
components
๋๋ ํ ๋ฆฌ ํ์์ ๋ถ๋ฅ๋ ๋๋ ํ ๋ฆฌ (ex.display
) ์ ๋ง์ถฐ ์ปดํฌ๋ํธ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค
์)
Card
์ปดํฌ๋ํธ๋ฅผ ๋ง๋๋ ๊ฒฝ์ฐsrc/components/display/Card
๋๋ ํ ๋ฆฌ ์์ฑ
์ปดํฌ๋ํธ์ ๊ฒฝ์ฐ index.tsx
๋ก ์์ฑํ๊ณ ํ์ดํํจ์๋ฅผ ์ฌ์ฉํด Named Export ๋ก ๋ด๋ณด๋
๋๋ค.
์ปดํฌ๋ํธ์ ์ฌ์ฉ๋๋ Props ๋ interface
๋ก ์ ์ธํ๋ฉฐ, ์ปดํฌ๋ํธ๋ช
Props
๋ก ํต์ผํฉ๋๋ค.
์)
src/components/display/Card/index.tsx
export interface CardProps { width: SizeProp; height: SizeProp; } export const Card = ({ width, height } : CardProps) => { return <></> }
์คํ์ผ์ ๊ฒฝ์ฐ index.style.ts
๋ก ์์ฑํ๊ณ ์ปดํฌ๋ํธ ํ์ผ์์ ๋ค์๊ณผ ๊ฐ์ด import ํ์ฌ ์ฌ์ฉํฉ๋๋ค.
๐ก ํ) ์ปดํฌ๋ํธ์ ์ฌ์ฉ๋๋ @emotion/styled
์ ๋ํ ์ปดํฌ๋ํธ๋ ๋ค์๊ณผ ๊ฐ์ด ๋ช
์ํ๋ฉด ์ข์ต๋๋ค
Wrapper
> Container
> Items
> Item
๋๋
Wrapper
> Container
> Header
| Body
| Footer
์)
src/components/display/Card/index.style.ts
import * as Style from "@/path/to/style";
์คํ ๋ฆฌ๋ถ์ ๊ฒฝ์ฐ index.story.tsx
๋ก ์์ฑํฉ๋๋ค.
์ปดํฌ๋ํธ์ ๊ฒฝ์ฐ PascalCase
๋ค์ด๋ฐ ๊ท์น์ ๋ฐ๋ฆ
๋๋ค.
์ด์ธ์ ํจ์๋ ๋ณ์๋ camelCase
๋ค์ด๋ฐ ๊ท์น์ ๋ฐ๋ฆ
๋๋ค.
๋จ, ์คํ์ผ ๊ด๋ จ ๋ณ์ ๋๋ ํจ์์ ๊ฒฝ์ฐ snake_case
๋ค์ด๋ฐ ๊ท์น์ ๋ฐ๋ฆ
๋๋ค.