-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f862424
commit 33b4d38
Showing
12 changed files
with
559 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import { createVanillaExtractPlugin } from '@vanilla-extract/next-plugin'; | ||
const withVanillaExtract = createVanillaExtractPlugin(); | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
// TODO 디자인 시스템 패키지 추가 필요 | ||
// https://vanilla-extract.style/documentation/integrations/next/ | ||
const nextConfig = { | ||
transpilePackages: ['@repo/ui', '@repo/theme'], | ||
}; | ||
|
||
export default withVanillaExtract(nextConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
import { Icon } from '@repo/ui'; | ||
|
||
export default function Home() { | ||
return <div>웹 1팀 파이팅!</div>; | ||
return ( | ||
<div> | ||
웹 1팀 파이팅! | ||
<Icon width={100} height={100} name="stack" fill="semantic.blue" /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { style, createVar, globalStyle } from '@vanilla-extract/css'; | ||
|
||
export const strokeColor = createVar(); | ||
export const fillColor = createVar(); | ||
|
||
export const parent = style({}); | ||
|
||
globalStyle(`.${parent} path`, { | ||
stroke: strokeColor, | ||
fill: fillColor, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { FC, SVGProps } from 'react'; | ||
import { icons } from './assets'; | ||
import { tokens } from '@repo/theme'; | ||
import * as styles from './Icon.css'; | ||
import { assignInlineVars } from '@vanilla-extract/dynamic'; | ||
|
||
type IconName = keyof typeof icons; | ||
|
||
type Colors = typeof tokens.colors; | ||
|
||
type ColorType = | ||
| `primary.${keyof Colors['primary']}` | ||
| `semantic.${keyof Colors['semantic']}` | ||
| `grey.${keyof Colors['grey']}`; | ||
|
||
interface IconProps extends SVGProps<SVGSVGElement> { | ||
name: IconName; | ||
fill?: ColorType; | ||
stroke?: ColorType; | ||
} | ||
|
||
export const Icon: FC<IconProps> = ({ | ||
name, | ||
stroke, | ||
fill, | ||
...rest | ||
}: IconProps) => { | ||
const SVG = icons[name] as FC<SVGProps<SVGSVGElement>>; | ||
|
||
const getColor = (color?: ColorType): string => { | ||
if (!color) return 'transparent'; | ||
const [category, key] = color.split('.') as [keyof Colors, string]; | ||
return tokens.colors[category][key as keyof Colors[typeof category]]; | ||
}; | ||
|
||
const resolvedFill = getColor(fill) || 'transparent'; | ||
const resolvedStroke = getColor(stroke) || 'transparent'; | ||
|
||
return ( | ||
<SVG | ||
className={styles.parent} | ||
style={JSON.parse( | ||
JSON.stringify( | ||
assignInlineVars({ | ||
[styles.strokeColor]: resolvedStroke, | ||
[styles.fillColor]: resolvedFill, | ||
}) | ||
) | ||
)} | ||
{...rest} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
//export * from './TestComponent'; | ||
export * from './Icon/Icon'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './components'; | ||
export * from './icons'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.