-
Notifications
You must be signed in to change notification settings - Fork 4
refactor(flex): apply vanilla-extract #163
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1cd4255
refactor(flex): migrate to Vanilla Extract
jiji-hoon96 67b0d70
refactor(flex): migrate to Vanilla Extract
jiji-hoon96 9649d25
refactor(flex): migrate to Vanilla Extract
jiji-hoon96 022f19e
Update packages/flex/src/Flex.tsx
jiji-hoon96 2300765
fix(flex): migrate to Vanilla Extract
jiji-hoon96 12bea31
fix(flex): migrate to Vanilla Extract
jiji-hoon96 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 hidden or 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 hidden or 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,47 @@ | ||
import { style, styleVariants } from '@vanilla-extract/css'; | ||
import type { FlexDirection, FlexAlign, FlexJustify, FlexWrap } from './constants'; | ||
|
||
export const base = style({ | ||
display: 'flex', | ||
}); | ||
|
||
const directionStyles: Record<FlexDirection, { flexDirection: FlexDirection }> = { | ||
row: { flexDirection: 'row' }, | ||
column: { flexDirection: 'column' }, | ||
'row-reverse': { flexDirection: 'row-reverse' }, | ||
'column-reverse': { flexDirection: 'column-reverse' }, | ||
}; | ||
export const direction = styleVariants(directionStyles); | ||
|
||
const alignStyles: Record<FlexAlign, { alignItems: FlexAlign }> = { | ||
'flex-start': { alignItems: 'flex-start' }, | ||
'flex-end': { alignItems: 'flex-end' }, | ||
center: { alignItems: 'center' }, | ||
stretch: { alignItems: 'stretch' }, | ||
baseline: { alignItems: 'baseline' }, | ||
normal: { alignItems: 'normal' }, | ||
}; | ||
export const align = styleVariants(alignStyles); | ||
|
||
const justifyStyles: Record<FlexJustify, { justifyContent: FlexJustify }> = { | ||
'flex-start': { justifyContent: 'flex-start' }, | ||
'flex-end': { justifyContent: 'flex-end' }, | ||
center: { justifyContent: 'center' }, | ||
'space-between': { justifyContent: 'space-between' }, | ||
'space-around': { justifyContent: 'space-around' }, | ||
'space-evenly': { justifyContent: 'space-evenly' }, | ||
normal: { justifyContent: 'normal' }, | ||
}; | ||
export const justify = styleVariants(justifyStyles); | ||
|
||
const wrapStyles: Record<FlexWrap, { flexWrap: FlexWrap }> = { | ||
nowrap: { flexWrap: 'nowrap' }, | ||
wrap: { flexWrap: 'wrap' }, | ||
'wrap-reverse': { flexWrap: 'wrap-reverse' }, | ||
}; | ||
export const wrap = styleVariants(wrapStyles); | ||
|
||
export const display = styleVariants({ | ||
flex: { display: 'flex' }, | ||
'inline-flex': { display: 'inline-flex' }, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,19 @@ | ||
export const FLEX_DIRECTIONS = ['row', 'column', 'row-reverse', 'column-reverse'] as const; | ||
export type FlexDirection = (typeof FLEX_DIRECTIONS)[number]; | ||
|
||
export const FLEX_ALIGNS = ['flex-start', 'flex-end', 'center', 'stretch', 'baseline', 'normal'] as const; | ||
export type FlexAlign = (typeof FLEX_ALIGNS)[number]; | ||
|
||
export const FLEX_JUSTIFY_CONTENTS = [ | ||
'flex-start', | ||
'flex-end', | ||
'center', | ||
'space-between', | ||
'space-around', | ||
'space-evenly', | ||
'normal', | ||
] as const; | ||
export type FlexJustify = (typeof FLEX_JUSTIFY_CONTENTS)[number]; | ||
|
||
export const FLEX_WRAPS = ['nowrap', 'wrap', 'wrap-reverse'] as const; | ||
export type FlexWrap = (typeof FLEX_WRAPS)[number]; |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
이렇게 상수로 뺄거면 sprinkle 활용해서 properties를 css.ts 에서 다 관리해보는건 어떨까요 ? 이건.. 저도 뭐가 옳은가 찾아보다가 확신이 안들어서.. 의견을 묻습니다 ㅠㅠ
@jiji-hoon96 @noahluftyang
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.
유사한 스타일 패턴이 다른 컴포넌트들(Grid, Stack, Box 등)에서도 반복될 것으로 예상되므로, design system 전체 관점에서 vanilla-extract 확장 기능 도입을 논의해보면 좋을 것 같아.
특히 recipe와 sprinkles는 design system의 일관성과 개발 효율성 측면에서 활용도가 높아보여. 단 라이브러리 의존성에 대한 고민도 좀 해봐야할듯해
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.
@jiji-hoon96
컴포넌트별로 따로 버전관리하고 있으니까.. 아무래도 의존성 같은 부분은 더 생각해봐야겠네
자주 참고하는 디자인시스템인데, 이런식으로 자주쓰이는건 공통 유틸로도 빼서 사용하구 있는거 같더라구, 일단 이건 더 나중에 이야기해보아욤