-
Notifications
You must be signed in to change notification settings - Fork 1
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
Init CSS tokens #316
Merged
Merged
Init CSS tokens #316
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bcb5687
feat(design-token): add basic design tokens
SnowSuno bf9ed5a
feat(eslint): allow `css` props in eslint
SnowSuno cf25a34
feat(css): add layout and size styles
SnowSuno 33e0680
feat(css): add main page example
SnowSuno 0779bfa
feat(css): enable css props
SnowSuno 1f07938
chore(pnpm): update lockfile
SnowSuno f55ca63
chore(lint): lint eslintrc
SnowSuno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,13 @@ | ||
import { mapColors } from "@/styles/color"; | ||
import { css } from "@emotion/react"; | ||
|
||
/** | ||
* Applies background-color | ||
* @example | ||
* bg.gray100 // Apply gray100 background-color | ||
*/ | ||
export const bg = mapColors( | ||
color => css` | ||
background-color: ${color}; | ||
`, | ||
); |
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,14 @@ | ||
import { css } from "@emotion/react"; | ||
import { mapColors } from "@/styles/color"; | ||
|
||
/** | ||
* Applies border | ||
* @example | ||
* border.gray300 // Apply gray300 border | ||
* [border.gray300, round.md] // Usage with `round` mixin | ||
*/ | ||
export const border = mapColors( | ||
color => css` | ||
border: 1px solid ${color}; | ||
`, | ||
); |
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,32 @@ | ||
export const colors = { | ||
white: "#FFFFFF", | ||
black: "#444444", | ||
white100: "#FAFBFC", | ||
gray100: "#FAFAFA", | ||
gray200: "#EEEEEE", | ||
gray300: "#D9D9D9", | ||
gray400: "#B6B6B6", | ||
gray500: "#8C8C8C", | ||
gray600: "#555555", | ||
grayTrans: "rgba(85, 85, 85, 0.1)", | ||
blue100: "#FAFCFF", | ||
blue200: "#E7F0FF", | ||
blue300: "#BFDCFF", | ||
blue400: "#6EABF4", | ||
blue500: "#2F80DE", | ||
blue600: "#065DAC", | ||
blue700: "#004B81", | ||
purpleLight: "#F6EEFE", | ||
purple: "#9836EF", | ||
orangeLight: "#FDF7E6", | ||
orange: "#FF9211", | ||
greenLight: "#E9F9EF", | ||
green: "#008B1C", | ||
} as const; | ||
|
||
type ColorKeys = keyof typeof colors; | ||
export type Color = (typeof colors)[ColorKeys]; | ||
export const mapColors = <T>(cb: (color: Color) => T) => | ||
Object.fromEntries( | ||
Object.entries(colors).map(([key, value]) => [key, cb(value)] as const), | ||
) as Record<ColorKeys, T>; |
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,8 @@ | ||
export * from "./background"; | ||
export * from "./border"; | ||
export * from "./color"; | ||
export * from "./layout"; | ||
export * from "./round"; | ||
export * from "./spacing"; | ||
export * from "./text"; | ||
export * from "./size"; |
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,59 @@ | ||
import { css } from "@emotion/react"; | ||
|
||
export const column = css` | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
export const row = css` | ||
display: flex; | ||
flex-direction: row; | ||
`; | ||
|
||
export const center = css` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
`; | ||
|
||
export const justify = { | ||
start: css` | ||
justify-content: flex-start; | ||
`, | ||
center: css` | ||
justify-content: center; | ||
`, | ||
end: css` | ||
justify-content: flex-end; | ||
`, | ||
between: css` | ||
justify-content: space-between; | ||
`, | ||
around: css` | ||
justify-content: space-around; | ||
`, | ||
} as const; | ||
|
||
export const align = { | ||
start: css` | ||
align-items: flex-start; | ||
`, | ||
center: css` | ||
align-items: center; | ||
`, | ||
end: css` | ||
align-items: flex-end; | ||
`, | ||
stretch: css` | ||
align-items: stretch; | ||
`, | ||
} as const; | ||
|
||
/** | ||
* Applies flexbox with column direction | ||
* @example | ||
* gap(10) // Apply 10px gap | ||
*/ | ||
export const gap = (value: number) => css` | ||
gap: ${value}px; | ||
`; |
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,16 @@ | ||
import { css } from "@emotion/react"; | ||
|
||
/** | ||
* Applies border radius | ||
* @example | ||
* round.md // Apply 5px radius | ||
* round.lg // Apply 10px radius | ||
*/ | ||
export const round = { | ||
md: css` | ||
border-radius: 5px; | ||
`, | ||
lg: css` | ||
border-radius: 10px; | ||
`, | ||
} as const; |
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,29 @@ | ||
import { css } from "@emotion/react"; | ||
|
||
const applyAttribute = (attribute: "height" | "width") => | ||
Object.assign( | ||
(value: number) => css` | ||
${attribute}: ${value}px; | ||
`, | ||
{ | ||
fill: css` | ||
${attribute}: 100%; | ||
`, | ||
}, | ||
); | ||
|
||
/** | ||
* Applies height | ||
* @example | ||
* h(10) // 10px height | ||
* h.fill // 100% height | ||
*/ | ||
export const h = applyAttribute("height"); | ||
|
||
/** | ||
* Applies width | ||
* @example | ||
* w(10) // 10px width | ||
* w.fill // 100% width | ||
*/ | ||
export const w = applyAttribute("width"); |
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,31 @@ | ||
import { css } from "@emotion/react"; | ||
|
||
const style = (attribute: string) => (value: number) => css` | ||
${attribute}: ${value}px; | ||
`; | ||
|
||
const applyPrefix = (prefix: "padding" | "margin") => | ||
Object.assign(style(prefix), { | ||
top: style(`${prefix}-top`), | ||
bottom: style(`${prefix}-bottom`), | ||
left: style(`${prefix}-left`), | ||
right: style(`${prefix}-right`), | ||
vertical: style(`${prefix}-block`), | ||
horizontal: style(`${prefix}-inline`), | ||
}); | ||
|
||
/** | ||
* @example | ||
* padding(10) // 10px padding for all sides | ||
* padding.top(5) // 5px padding for top | ||
* padding.horizontal(8) // 8px padding for left and right | ||
*/ | ||
export const padding = applyPrefix("padding"); | ||
|
||
/** | ||
* @example | ||
* margin(10) // 10px margin for all sides | ||
* margin.top(5) // 5px margin for top | ||
* margin.horizontal(8) // 8px margin for left and right | ||
*/ | ||
export const margin = applyPrefix("margin"); |
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,32 @@ | ||
import { css } from "@emotion/react"; | ||
import { mapColors } from "@/styles/color"; | ||
|
||
const style = (size: number, weight: number) => css` | ||
font-size: ${size}px; | ||
font-weight: ${weight}; | ||
`; | ||
|
||
/** | ||
* Applies typography styles and text color | ||
* @example | ||
* text.title1 // Apply title1 typography | ||
* text.gray300 // Apply gray300 text color | ||
*/ | ||
export const text = { | ||
...mapColors( | ||
color => css` | ||
color: ${color}; | ||
`, | ||
), | ||
title1: style(15, 500), | ||
title2: style(14, 500), | ||
title3: style(13, 500), | ||
subtitle: style(11, 500), | ||
body: style(12, 500), | ||
option1: style(10, 500), | ||
option2: style(9, 500), | ||
boldtitle1: style(14, 700), | ||
boldtitle2: style(13, 700), | ||
boldtitle3: style(12, 700), | ||
boldtitle4: style(11, 700), | ||
} as const; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
나중에 이것도 같은 형식으로 이쁘게 처리해줘 a값 받을수있게???