-
Notifications
You must be signed in to change notification settings - Fork 6
feat(button): Redesign Button component based on 5th generation design system #263
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
base: dev
Are you sure you want to change the base?
Changes from all commits
8efad74
90019aa
d95c953
df65451
831d8af
1f95a0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| "@sipe-team/button": major | ||
| "@sipe-team/tokens": minor | ||
| --- | ||
|
|
||
| Redesign Button component based on 5th generation design system | ||
|
|
||
| - **BREAKING**: Rename `ButtonVariant.filled` to `ButtonVariant.fill` | ||
| - **BREAKING**: Expand `ButtonSize` from `sm | lg` to `sm | md | lg | xl` | ||
| - Add `leftIcon` and `rightIcon` props for icon support | ||
| - Apply 5th design colors via `createVar()` (button-scoped CSS variables) | ||
| - Add interaction states: hover (gradient), pressed (`#FE4E07`), disabled (`gray500/600`) | ||
| - Fix disabled CSS specificity bug by moving styles into recipe base selectors | ||
| - Add `theme5th` color token to `@sipe-team/tokens` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,115 @@ | ||
| import { vars } from '@sipe-team/tokens'; | ||
| import { color, vars } from '@sipe-team/tokens'; | ||
|
|
||
| import { style } from '@vanilla-extract/css'; | ||
| import { createVar, style } from '@vanilla-extract/css'; | ||
| import { recipe } from '@vanilla-extract/recipes'; | ||
|
|
||
| import { ButtonSize, ButtonVariant } from './Button'; | ||
|
|
||
| export const disabled = style({ | ||
| opacity: 0.4, | ||
| cursor: 'not-allowed', | ||
| pointerEvents: 'none', | ||
| export const buttonOrange = createVar(); | ||
| export const buttonGradient = createVar(); | ||
| export const buttonRed = createVar(); | ||
|
|
||
| export const iconWrapper = style({ | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| flexShrink: 0, | ||
| }); | ||
|
|
||
| export const iconLayout = style({ | ||
| gap: vars.spacing.component.md, | ||
| }); | ||
|
|
||
| export const button = recipe({ | ||
| base: { | ||
| vars: { | ||
| [buttonOrange]: '#FF7C27', | ||
| [buttonGradient]: 'linear-gradient(225deg, #FF4500 0%, #FFB24D 100%)', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기 추후 토큰이 그라디언트 자체로 끼워지는건가요?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Yeom-JinHo 넵넵 color.5th.gradient 처럼 5기 전용 그라디언트 토큰으로 들어가게 될 것 같습니다 hover 상태를 그라디언트 색상으로 진행하고 싶어하시더라고요!! |
||
| [buttonRed]: '#FE4E07', | ||
| }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이것도 마찬가지로, 여기만 독자적인 스타일을 쓰는 게 아니라, |
||
| display: 'flex', | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| borderRadius: vars.radius.component.md, | ||
| fontStyle: 'normal', | ||
| fontWeight: vars.typography.fontWeight.semiBold, | ||
| lineHeight: '150%', | ||
| cursor: 'pointer', | ||
| transition: 'all 0.2s ease-in-out', | ||
| border: 'none', | ||
| fontFamily: vars.typography.fontFamily, | ||
| ':focus-visible': { | ||
| outline: `2px solid ${vars.color.border.focus}`, | ||
| outline: `2px solid ${buttonOrange}`, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 포커스링은 브랜드 컬러보다는, @3o14 님 크로스체크 부탁드립니다 |
||
| outlineOffset: '2px', | ||
| }, | ||
| selectors: { | ||
| '&:disabled, &[aria-disabled="true"]': { | ||
| backgroundColor: color.gray500, | ||
| color: color.gray600, | ||
| cursor: 'not-allowed', | ||
| pointerEvents: 'none', | ||
| border: 'none', | ||
| background: color.gray500, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. backgroundColor: color.gray500, |
||
| }, | ||
| }, | ||
| }, | ||
| variants: { | ||
| variant: { | ||
| [ButtonVariant.filled]: { | ||
| backgroundColor: vars.color.accent.default, | ||
| color: vars.color.foreground.onAccent, | ||
| border: 'none', | ||
| [ButtonVariant.fill]: { | ||
| backgroundColor: buttonOrange, | ||
| color: '#000', | ||
| ':hover': { | ||
| backgroundColor: vars.color.accent.hover, | ||
| background: buttonGradient, | ||
| }, | ||
| ':active': { | ||
| background: buttonRed, | ||
| }, | ||
| }, | ||
| [ButtonVariant.outline]: { | ||
| backgroundColor: 'transparent', | ||
| border: `1px solid ${vars.color.accent.default}`, | ||
| color: vars.color.accent.default, | ||
| ':hover': { | ||
| backgroundColor: vars.color.accent.default, | ||
| color: vars.color.foreground.onAccent, | ||
| }, | ||
| border: `1px solid ${buttonOrange}`, | ||
| color: buttonOrange, | ||
| }, | ||
| [ButtonVariant.ghost]: { | ||
| backgroundColor: 'transparent', | ||
| border: 'none', | ||
| color: vars.color.accent.default, | ||
| color: buttonOrange, | ||
| ':hover': { | ||
| backgroundColor: vars.color.accent.subtle, | ||
| opacity: 0.8, | ||
| }, | ||
| ':active': { | ||
| color: buttonRed, | ||
| }, | ||
| }, | ||
| }, | ||
| size: { | ||
| [ButtonSize.sm]: { | ||
| height: '32px', | ||
| padding: `0 ${vars.spacing.component.sm}`, | ||
| fontSize: vars.typography.fontSize['200'], | ||
| lineHeight: vars.typography.lineHeight.compact, | ||
| padding: `0 ${vars.spacing.component.xs}`, | ||
| borderRadius: vars.radius.component.md, | ||
| fontSize: vars.typography.fontSize['050'], | ||
| }, | ||
| [ButtonSize.md]: { | ||
| height: '40px', | ||
| padding: '0 12px', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이것도 마찬가지로. |
||
| borderRadius: '6px', | ||
| fontSize: vars.typography.fontSize['100'], | ||
| }, | ||
| [ButtonSize.lg]: { | ||
| height: '48px', | ||
| padding: `0 ${vars.spacing.component.lg}`, | ||
| fontSize: vars.typography.fontSize['400'], | ||
| lineHeight: vars.typography.lineHeight.regular, | ||
| padding: `0 ${vars.spacing.component.sm}`, | ||
| borderRadius: '6px', | ||
| fontSize: vars.typography.fontSize['200'], | ||
| }, | ||
| [ButtonSize.xl]: { | ||
| height: '64px', | ||
| padding: `0 ${vars.spacing.component.md}`, | ||
| borderRadius: vars.radius.component.lg, | ||
| fontSize: vars.typography.fontSize['500'], | ||
| }, | ||
| }, | ||
| }, | ||
| compoundVariants: [], | ||
| defaultVariants: { | ||
| variant: ButtonVariant.filled, | ||
| variant: ButtonVariant.fill, | ||
| size: ButtonSize.lg, | ||
| }, | ||
| }); | ||
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.
이거 쓰지말고,
#258
에서,
packages/button/src/Button.css.ts
vars.color.accent.* 같은 걸로 쓸 수 있을지 검토해주세요
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.
지훈님 말씀처럼 가능한 토큰 시스템 이용해주시면 v2 token으로 마이그레이션할 때도 수월할 것 같아요!