๐ PR ๋ฐ๋ก๊ฐ๊ธฐ ๐
Fix Table Component Scroll & Light Mode Color Issues by arty0928 · Pull Request #461 · dev-five-git/devup-ui
Resolves #460 Problem 1: Table not horizontally scrollable on mobile devices The props table in component documentation pages was not horizontally scrollable on mobile devices, causing content to...
github.com
๋ค์ด๊ฐ๋ฉฐ
์คํ์์ค ์ปจํธ๋ฆฌ๋ทฐ์ ์์นด๋ฐ๋ฏธ OSCCA ์ 'devupUI : zero-runtime Css-in-JS Libray'์ ์ฐธ์ฌํ๋ฉฐ Toggle ์ปดํฌ๋ํธ ๋ฌธ์ํ์ ๋์ ํ์ต๋๋ค. ๊ทธ ๊ณผ์ ์์ ๊ธฐ์กด ์ ์ผํ๊ฒ ์์ฑ๋์ด ์๋ button ์ปดํฌ๋ํธ๋ฅผ ๊ธฐ์ค์ผ๋ก ์์ฑํ๋ ์ค, button ์ปดํฌ๋ํธ ๋ฌธ์์์ ๋งํฌ๋ค์ด ๋ฌธ๋ฒ์ด ๊นจ์ง๋ ํ์์ ๋ฐ๊ฒฌํ์ต๋๋ค. ๐ ์ด์ ๊ธ ๋ณด๊ณ ๋ฐฐ๊ฒฝ ์ดํดํ๊ธฐ ๐ ์์ ํฌ์คํ ์์ ํด๋น ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ณ , Table ๋ฐ์ํ ์ข์ฐ ์คํฌ๋กค ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ณ , ์ด๋ฒ์๋ '๋ผ์ดํธ๋ชจ๋ CSS ๋ฏธ์ ์ฉ ๋ฌธ์ ํด๊ฒฐ๊ธฐ' ๋ฅผ ์ ๋ฆฌํ์์ต๋๋ค.
๋ฌธ์ ์ํฉ : ํ ์ด๋ธ ์ปดํฌ๋ํธ์ ``๋ก ๊ฐ์ผ ์ฝ๋ ๋ธ๋ก ๋ผ์ดํธ๋ชจ๋์์ ์ ๋ณด์
`` ๋ฐฑํฑ์ผ๋ก ๊ฐ์ผ ์ฝ๋๊ฐ ๋คํฌ๋ชจ๋์์๋ ์ฝ๊ฐ ํ์๊ฒ(?) ์ ๋ณด์ด์ง๋ง, ๋ผ์ดํธ๋ชจ๋์์๋ ์์ ๊ตฌ๋ถ์ด ๊ฐ์ง ์์ต๋๋ค.
| ๋ผ์ดํธ ๋ชจ๋ | ๋คํฌ ๋ชจ๋ |
![]() |
![]() |
๊ทธ๋์ ๊ธฐ์กด PropsTable ์ฝ๋๋ฅผ ๋ค์ ์ดํด๋ณด์์ต๋๋ค.
์์ธ : PropsTable์์ ์ฝ๋ ๋ธ๋ก์ CustomCodeBlock์ ์ฌ์ฉํ์ฌ ``์ ์คํ์ผ๋ง์ด ์ ๋๋ก ๋์ํ์ง ์์
const MdxComponentsWithCodeBlock = ({ children }: { children?: string }) => {
return (
<Markdown
components={{
...(_components as any),
code: CustomCodeBlock,
}}
>
{children}
</Markdown>
)
}
๊ทธ ์ค์์ CodeBlock ๋ถ๋ถ์ธ CustomCodeBlock์ ์ดํด๋ณด์์ต๋๋ค.
CustomCodeBlock
import { Box, Text } from '@devup-ui/react'
export function CustomCodeBlock({ children }: { children: string }) {
return (
<Box
as="code"
bg="$containerBackground"
borderRadius="0.25rem"
color="$text"
padding="0.25rem"
whiteSpace="pre-wrap"
>
{children.split('<br>').map((line, index) => (
<Text key={index.toString()} whiteSpace="pre">
{index > 0 && <br />}
{line}
</Text>
))}
</Box>
)
}
CustomCodeBlock ์์ bg="$containerBackground"์ color="$text"๋ฅผ ์ฌ์ฉํ๊ณ ์๋๋ฐ,
์์ฌ๊ฐ๋ ์์ธ
- ์ด CSS ๋ณ์๋ค์ด ๋ผ์ดํธ๋ชจ๋์์ ์ ๋๋ก ์ ์๋์ง ์์๊ฑฐ๋
- ์์ด ๋์๋๋ ์ฐจ์ด๊ฐ ์๋ ๊ฒ
์ผ๋ก ์์ํ์ต๋๋ค.
1. CSS ๋ณ์๊ฐ ์ ์๋์๋์ง ํ์ธํ๊ธฐ
์ฐ์ $containerBackground ๋ณ์ ๋ถ๋ถ์์ถ์ ํ์ต๋๋ค.

<Card
className={css({
_active: {
transform: 'none',
},
_hover: {
boxShadow: 'none',
},
borderRadius: '10px',
border: '1px solid $border',
bg: '$containerBackground',
maxW: '100%',
flexShrink: 0,
cursor: 'default',
mb: '20px',
_lastChild: {
mb: '0',
},
typography: 'bodyReg',
color: '$text',
whiteSpace: 'pre-wrap',
})}
>
๋์ผํ ํ์ด์ง ๋ด์์ Button ์์๋ฅผ ๋ณด์ฌ์ฃผ๋ Card์ ์ ์ฉ๋ bg ์ปฌ๋ฌ์๋ ๋คํฌ๋ชจ๋, ๋ผ์ดํธ๋ชจ๋ ์ ์ฉํ์ ๋ ๋ฐฑ๊ทธ๋ผ์ด๋ ์ปฌ๋ฌ๋ ์ ์ ์ฉ๋๊ณ ์์์ต๋๋ค.
๊ทธ ๋ค์ $text๋ ์ ์๋ ๋์ด ์์์ต๋๋ค.
๊ทธ๋ผ ์ด์ CSS ๋ณ์ ๋ฏธ์ ์๋ ์๋๊ณ , ๋จ์ ์์ฌ์ ๊ฐ ์์ด ๋์ ๋๊ฒ ๋๋น๊ฐ ๋์ง ์์๋? ํด์
ํ ๋ง ๋ณ์ ์ ์๊ฐ ์ด๋์์ ๋์๋์ง ์์น๋ก ๊ฐ์ ํ์ธํด๋ณด๋ ค๊ณ ํ์ต๋๋ค.
2. ํ ๋ง ํ์ผ ์ฐพ๊ธฐ
find . -name "theme.*" -o -name "tokens.*" -o -name "colors.*"
๊ทธ๋์ ์ฐพ์ ./apps/landing/df/theme.d.ts ํ์ผ์ ๋ฐ๊ฒฌํ์ต๋๋ค.
์กฐ๊ธ ๋ ๋ฐ๋ผ๊ฐ๋ค ๋ณด๋ devup.json ํ์ผ์์ theme ๋ณ๋ก ๋ผ์ดํธ ๋ชจ๋, ๋คํฌ ๋ชจ๋ ์์์ ๊ด๋ฆฌํ๊ณ ์์๋๋ฐ, ์ฌ๊ธฐ์ containerBackgroundColor์ ์์ ์กฐ๊ธ ๋ ์งํ๊ฒ ํด์ text ์ ์์๊ณผ ๋๋น๋๊ฒ ๋ณ๊ฒฝํ์ต๋๋ค.
{
"theme": {
"colors": {
"light": {
"primary": "#5A44FF",
"secondary": "#85A5F2",
"link": "#006BFF",
"text": "#2F2F2F",
"background": "#FFF",
"containerBackground": "#F0F505",
...
},
"dark": {
"primary": "#9086FF",
"secondary": "#2A4586",
"link": "#006BFF",
"text": "#EDEDED",
"background": "#131313",
"containerBackground": "#373639",
....
}
},
๊ทธ๋ฐ๋ฐ ๋ฐ๊ฟ๋ณด๋ ํ์ฌ containerBackground ์ ์์ฒด๋ฅผ ๋ฐ๊พธ๊ธฐ์๋ ๋ค๋ฅธ ๊ณณ์์ ์ด๋ฏธ ๋ง์ด ์ฌ์ฉ ์ค์ด๊ธฐ์, codeBackGround๋ผ๋ ์์์ ์๋กญ๊ฒ ์ ์ํ์ต๋๋ค.
์ต์ข ์ฝ๋
{
"theme": {
"colors": {
"light": {
"primary": "#5A44FF",
"secondary": "#85A5F2",
"link": "#006BFF",
"text": "#2F2F2F",
"background": "#FFF",
"containerBackground": "#FFF",
"codeBackground": "#F5F5F5", //์ถ๊ฐ
},
"dark": {
"primary": "#9086FF",
"secondary": "#2A4586",
"link": "#006BFF",
"text": "#EDEDED",
"background": "#131313",
"containerBackground": "#373639",
"codeBackground": "#2E2E2E", //์ถ๊ฐ
}
},
์ต์ข ๊ฒฐ๊ณผ
์ด์ ๋ผ์ดํธ๋ชจ๋์์๋ ์ฝ๋ ๋ธ๋ก CSS ๊ฐ ๋์ ๋๊ฒ ์ ์ ์ฉ๋์์ต๋๋ค.
| ๋ผ์ดํธ ๋ชจ๋ | ๋คํฌ ๋ชจ๋ |
![]() |
![]() |




