-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
๐ง ๋ฆฌ๋๋ฆฌ์, ์คํ ๋ฆฌ๋ถ ์ค์ #18
Conversation
import type { StorybookConfig } from "@storybook/nextjs"; | ||
import MiniCssExtractPlugin, { Configuration } from "mini-css-extract-plugin"; | ||
|
||
const withLinaria = (config: Configuration) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฆฌ๋๋ฆฌ์์ฉ ์นํฉ ์ค์ ํ๋ ๋ถ๋ถ์
๋๋ค
๋ฐ๋ฒจ๋ก๋์ ๋ฆฌ๋๋ฆฌ์ ์นํฉ๋ก๋ ๋ชจ๋ ์ค์ ํด์ค์ผํ๊ณ css ๋ก๋๋ ์ค์ ํด์ค์ผ ํฉ๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฆฌ๋๋ฆฌ์ ์คํ ๋ฆฌ๋ถ ์ค์ ์ด ๋ณต์กํ๋ค์ฌ ๊ณ ์ํ์ จ์ต๋๋ค ๐โโ๏ธ
(Story) => { | ||
const isDark = useDarkMode(); | ||
|
||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์คํ ๋ฆฌ๋ถ์์ ๋คํฌ/๋ผ์ดํธ๋ชจ๋ ๋ณ๊ฒฝํ๋ ๋ถ๋ถ ์
๋๋ค
์คํ ๋ฆฌ๋ถ ์์ฒด ์์์ด ๋ณ๊ฒฝ๋์ง ์๋๊ฑด ์คํ ๋ฆฌ๋ถ 7์ ์ด์๊ฐ ์๋ค๊ณ ํ๋ค์
์ฐธ๊ณ : storybookjs/storybook#21798
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ใ ใ .. ํ ๋ง ๋ณ๊ฒฝ ๋์๋ ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
"use client"; | ||
|
||
// FIXME: temporary solution | ||
export const ThemeSwitcher = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { commonThemeVar, darkThemeVar, lightThemeVar, theme } from "@/mds/theme"; | ||
import { css } from "@linaria/core"; | ||
|
||
export const globals = css` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linaria์ global css์
๋๋ค.
next-with-linaria
ํจํค์ง์์ ๋ค์ด๋ฐ ์ปจ๋ฒค์
์ด ์๊ธฐ ๋๋ฌธ์ ํ์ผ๋ช
์ ์ด๋ ๊ฒ ์ง์์ต๋๋ค
์ฐธ๊ณ : https://github.com/dlehmhus/next-with-linaria#global-styles-restrictions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ ๋ง๋ฅผ className์ผ๋ก ๊ตฌ๋ถํ๋ ๊ตฐ์ฌ ๐
|
||
//region Types | ||
|
||
interface ModePalette { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋์์ธ ์์คํ ์ด ์์ด ์์๋ก ๋ง๋ ๋ผ์ดํธ/๋คํฌ ๋ชจ๋ ํ๋ ํธ ํ์ ์ ๋๋ค
//region ThemeVar | ||
export const lightThemeVar = toCssVar({ palette: light }); | ||
export const darkThemeVar = toCssVar({ palette: dark }); | ||
export const commonThemeVar = toCssVar({ palette: common, font: { family: global.fontFamily.KR.value } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -18,6 +18,7 @@ | |||
"isolatedModules": true, | |||
"jsx": "preserve", | |||
"incremental": true, | |||
"baseUrl": ".", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseUrl
์ด ๋น ์ ธ์์ด์ @/xxx
importํ ๋ ๋ฌธ์ ๊ฐ ๋์์ต๋๋ค.
} | ||
}; | ||
|
||
export const theme: Theme = (<T extends object>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}; | ||
} | ||
|
||
type ColorKey = "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ๊ทธ๋ ์ด ์์์ 50, 75, 1000๋ ์์ต๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๊ณ ์ํ์ จ์ต๋๋น
import type { StorybookConfig } from "@storybook/nextjs"; | ||
import MiniCssExtractPlugin, { Configuration } from "mini-css-extract-plugin"; | ||
|
||
const withLinaria = (config: Configuration) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฆฌ๋๋ฆฌ์ ์คํ ๋ฆฌ๋ถ ์ค์ ์ด ๋ณต์กํ๋ค์ฌ ๊ณ ์ํ์ จ์ต๋๋ค ๐โโ๏ธ
(Story) => { | ||
const isDark = useDarkMode(); | ||
|
||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ใ ใ .. ํ ๋ง ๋ณ๊ฒฝ ๋์๋ ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
import { commonThemeVar, darkThemeVar, lightThemeVar, theme } from "@/mds/theme"; | ||
import { css } from "@linaria/core"; | ||
|
||
export const globals = css` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ ๋ง๋ฅผ className์ผ๋ก ๊ตฌ๋ถํ๋ ๊ตฐ์ฌ ๐
}); | ||
}; | ||
|
||
flattenRec(obj, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefix๊ฐ ๋ฌด์กฐ๊ฑด ""์ธ๋ฐ flattenRec์ prefix ์ธ์๋ฅผ ๋ง๋ ์ด์ ๊ฐ ์์๊น์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด์ ์ ์ฅ์์ ํด๋น ์ฝ๋์ ๋ํ ์ฃผ์์ด ์๋๋ฐ, ๊ฐ์ฒด๋ฅผ ํผ์น๋ ๊ณผ์ ์์ ์ด๊ธฐ์๋ง ๋น ๋ฌธ์์ด์ ๋ฃ๋ ๊ฒ ๊ฐ์์!
์ดํ์๋ ์ฌ๊ท๋ก ๋๋ฉด์ ๋ค์ค ๊ฐ์ฒด์ key ๊ฐ๋ค์ ๋ฃ๋ ๋ฏ ํฉ๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ต๋ต ๋๋ฌด๋์ด ๋ง์ํด์ฃผ์ ๋๋ก ์ฌ๊ท๋ก ์ฑ์์ง๋ ๋ฌธ์์ด์ ๋๋ค
) | ||
}), | ||
{} | ||
) as Colors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p5 ์ .. global.json ํ์ผ์ ๊ฐ์ฒด๋ก ๋ณํํด์ ts ํ์ผ๋ก ๋ง๋๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋๋ฆฌ๊ณ
ํด๋น ๊ฐ์ฒด๋ฅผ ๊ธฐ๋ฐ์ผ๋ก as const ํด์ readable ํ์
์ ๋ง๋ค์ด ์จ์ global ํ ํฐ ํ์
์ ๋ง๋๋ ๊ฑด ์ด๋จ๊น์?
๊ทธ๋ผ ์ ๋ ๊ฒ Colors ๋ผ๊ณ ๋ถ์ ํํ ํ์
์ aliasํ์ง ์์๋ ๋ ๊ฒ ๊ฐ์์.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Colors ํ์
์์ฒด๊ฐ global.color
์ key๊ฐ์ ํ์
์ผ๋ก ์ฝ์ด์ค๋๋ฐ ๊ด์ฐฎ์ง ์์๊น์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Doodream ๊ทธ๋ฌ๋ฉด style dictionary๋ฅผ ์จ์ json์ ts๋ก ๋ณํํ๋ค๋๊ฑธ ๋ง์ํ์ ๊ฑด๊ฐ์?
as Colors๋ก ์ฌ์ฉํ๋๊ฑด ์ ๋ ์กฐ๊ธ ๊ฑธ๋ฆฌ๊ธดํฉ๋๋ค... reduce
๋ก ํ์
์ถ๋ก ์ ์ ๋๋ก ๋ชปํด์ ๋ง๋ค์ด์ง ํ์
์ Record<string, Record<ColorKey, string>>
์ด์ง๋ง ์ค์ ๋ก๋ ์ ํ์
์ด ๋ง์์... ์์๋ก ์ด๋ ๊ฒ ํด๋๊ณ ๋ ์ข์ ๋ฐฉ๋ฒ์ด ์๋ค๋ฉด ๊ทธ๋ ๋ณ๊ฒฝํ๊ฒ ์ต๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฆฌ๋๋ฆฌ์ ์ธํ , ์คํ ๋ฆฌ๋ถ ์ค์ ์ ๋์์ธ ์์คํ ์ ์ฉ๊น์ง,, ์ ๋ง ๊ณ ์ ๋ง์ผ์ จ์ต๋๋ค. ๐
๋ณ๊ฒฝ ๋ด์ฉ
์ฒดํฌ๋ฆฌ์คํธ
๐ธ ์คํฌ๋ฆฐ์ท
๊ธฐํ์ฌํญ
๐ค๐ป ์ฝ๋๋ฆฌ๋ทฐ ํ๋ ๋ฐฉ๋ฒ
๐ชง [๊ฐ๋ฐ ๊ณตํต ์ฝ๋๋ฆฌ๋ทฐ ๊ฐ์ด๋]
โ Code Review Manner
โ Pn Rule
Pn
Pn Resolve
โ PR Title Rule
โ Comment Rule
โ Merge Rule