
styled-components
๐ styled-components
๐ฅ styled-components๋
๊ธฐ์กด ๋์ ๋ง๋๋ ๋ฐฉ์์ธ css, scss ํ์ผ์ ๋ฐ์ ๋๊ณ , ํ๊ทธ๋ id, class์ด๋ฆ์ผ๋ก ๊ฐ์ ธ์ ์ฐ์ง ์๊ณ , ๋์ผํ ์ปดํฌ๋ํธ์์ ์ปดํฌ๋ํธ ์ด๋ฆ์ ์ฐ๋ฏ ์คํ์ผ์ ์ง์ ํ๋ ๊ฒ์ styled-components๋ผ๊ณ ๋ถ๋ฆ ๋๋ค. css ํ์ผ์ ๋ฐ์ ๋์ง ์๊ณ , ์ปดํฌ๋ํธ ๋ด๋ถ์ ๋ฃ๊ธฐ ๋๋ฌธ์, css๊ฐ ์ ์ญ์ผ๋ก ์ค์ฒฉ๋์ง ์๋๋ก ๋ง๋ค์ด์ฃผ๋ ์ฅ์ ์ด ์์ต๋๋ค.
๐ฅ ํ๊ฒฝ์ค์

๐ฅ ์์

๐ฅ styled components ๋ง๋ค๊ธฐ
const ์ปดํฌ๋ํธ๋ช = styled.ํ๊ทธ๋ช ์คํ์ผ ๋ฃ๊ธฐ...๋ฌธ๋ฒ์ผ๋ก ๋ง๋ค์ด์ง๋๋ค. ๋ง๋ค๊ณ ์ํ๋ ์ปดํฌ๋ํธ์ render ํจ์ ๋ฐ์์ ๋ง๋ญ๋๋ค.
๐ฅ ์คํ์ผ์ props ์ ์ฉํ๊ธฐ
styled-component๋ฅผ ์ฌ์ฉํ๋ ์ฅ์ ์ค ํ๋๊ฐ ๋ณ์์ ์ํด ์คํ์ผ์ ๋ฐ๊ฟ ์ ์๋ค๋ ์ ์ ๋๋ค. ์ ์์๋ฅผ ๋ณด๋ฉด email์ด๋ผ๋ state๊ฐ์ ๋ฐ๋ผ ExampleWrap์ prop์ผ๋ก ๋ด๋ ค์ค active๋ผ๋ ๊ฐ์ด true or false๋ก ๋ฐ๋๊ฒ ๋ฉ๋๋ค. styled-component๋ ๋ด๋ถ์ ์ผ๋ก props์ ๋ฐ์ ์ ์๊ณ , ๊ทธ props์ ๋ฐ๋ผ ์คํ์ผ์ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค.
๐ฅ ์คํ์ผ ์์
const ์ปดํฌ๋ํธ๋ช = styled.์คํ์ผ์ปดํฌ๋ํธ๋ช ์คํ์ผ ๋ฃ๊ธฐ...๋ฌธ๋ฒ์ผ๋ก ๋ง๋ค์ด์ง๋๋ค. ๊ธฐ์กด์ ์๋ ์คํ์ผ์ปดํฌ๋ํธ๋ฅผ ์์๋ฐ์ ์ฌ์ฌ์ฉํฉ๋๋ค.
๐ฅ Mixin css props
css props๋ ์์ฃผ ์ฐ๋ css ์์ฑ์ ๋ด๋ ๋ณ์์
๋๋ค.
css ๋ณ์๋ช
= css์คํ์ผ... ๋ก ์ฌ์ฉํฉ๋๋ค.

๐ฅ ๋ค๋ฅธ ํ์ผ์์ ์ปดํฌ๋ํธ import
ํด๋น ํ์ผ์์ ์ ์ํ css๋ฅผ exportํ์ฌ ๋ค๋ฅธ ํ์ผ์์ import ํ ์ ์์ต๋๋ค.

๐ฅ ๋ฐ์ํ๋์์ธ
์ ์์๋ฅผ ์์ฉํ๋ฉด ๋ฐ์ํ์ ์ฝ๊ฒ ๋ง๋ค ์ ์์ต๋๋ค. styled-components-media (opens new window)์ด ๋งํฌ๋ฅผ ๊ณต๋ถํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.

๐ฅ global css
ํ๋ก์ ํธ ์ ์ญ์ผ๋ก ๋ฐ๋ํ๋ css๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค.

๐ฅ attribute ์ถ๊ฐ

๐ฅ css ๋ชจ๋ ๋ถ๋ฆฌ

๐ฅ global Theme
์ ์ญ์ผ๋ก css๋ฅผ ์ ์ํ ์ ์์ต๋๋ค. (์, css ๋ฑ)
1.root ๋ ๋ฒจ์ ๊ณต๋์ผ๋ก ์ฌ์ฉํ theme.js๋ฅผ ๋ง๋ ๋ค

2.ThemePrivider๋ฅผ ํ๋ก์ ํธ์ root dir์ importํ๊ณ ์๋์ ๊ฐ์ด ์ ์ํ๋ค

3.์ ์ญ์์ ํธ์ถํ์ฌ ์ฌ์ฉํ๋ค.

๐ฅ ๊ธ๋ก๋ฒ css์ minxin ๊ธฐ๋ฅ์ ๋ฃ๊ณ ์ด๋ ์ปดํฌ๋ํธ์์๋ ์ฌ์ฉํ๊ฒ ํ ์ ์์ต๋๋ค.
- global-styled.ts์ mixin์ ์ ์ํฉ๋๋ค.

2.global-styled๋ฅผ ์น์ ๊ฐ์ฅ ์๋จ index.js์ import ํฉ๋๋ค

3.์ดํ ์๋ฌด ์ปดํฌ๋ํธ์์๋ ๊ธ๋ก๋ฒ์์ ์ ์ํ mixin๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
