Repository navigation
feat: BlockButton, LabelButton, IconButton 로딩 상태 지원 #813
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
472a2db
49a07a0
4581c7c
bfcd879
6066fc3
17536ba
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,16 @@ | ||
| --- | ||
| "@jects/jds": minor | ||
| --- | ||
|
|
||
| **BlockButton** | ||
|
|
||
| `loading` prop을 추가하고, 버튼 내용을 감싸는 요소를 추가했습니다. 버튼의 직계 자식을 기준으로 스타일을 지정하던 소비처는 확인이 필요합니다. | ||
|
|
||
| **추가** | ||
|
|
||
| - `loading` — 기본값 `false`, 내용을 숨겨 너비를 유지한 채 아이콘 크기의 스피너를 가운데에 표시, `aria-busy`와 `aria-disabled`를 지정하고 클릭과 부모로의 클릭 전파, hover, pressed 오버레이를 막음, 포커스는 유지 | ||
| - `disabled`와 함께 지정하면 `disabled` 우선, `asChild`와는 함께 쓸 수 없음 | ||
|
|
||
| **동작 변경 (코드 수정 불필요)** | ||
|
|
||
| - 렌더 구조 — `asChild`가 아니면 아이콘과 레이블이 `button`의 직계 자식이 아니라 내부 `span`의 자식으로 렌더링, `button > [data-part='icon']` 같은 직계 자식 선택자나 루트의 `justify-content`로 아이콘과 레이블을 배치하던 스타일은 확인 필요 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| "@jects/jds": patch | ||
| --- | ||
|
|
||
| **IconButton** | ||
|
|
||
| `loading` prop을 추가했습니다. 기존 호출부는 수정할 필요가 없습니다. | ||
|
|
||
| - `loading` — 기본값 `false`, 내용을 숨겨 너비를 유지한 채 아이콘 크기의 스피너를 가운데에 표시, `aria-busy`와 `aria-disabled`를 지정하고 클릭과 부모로의 클릭 전파, hover, pressed 오버레이를 막음, 포커스는 유지 | ||
| - `disabled`와 함께 지정하면 `disabled` 우선, `asChild`와는 함께 쓸 수 없음 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| "@jects/jds": minor | ||
| --- | ||
|
|
||
| **LabelButton** | ||
|
|
||
| `loading` prop을 추가하고, 버튼 내용을 감싸는 요소를 추가했습니다. 버튼의 직계 자식을 기준으로 스타일을 지정하던 소비처는 확인이 필요합니다. | ||
|
|
||
| **추가** | ||
|
|
||
| - `loading` — 기본값 `false`, 내용을 숨겨 너비를 유지한 채 아이콘 크기의 스피너를 가운데에 표시, `aria-busy`와 `aria-disabled`를 지정하고 클릭과 부모로의 클릭 전파, hover, pressed 오버레이를 막음, 포커스는 유지 | ||
| - `disabled`와 함께 지정하면 `disabled` 우선, `asChild`와는 함께 쓸 수 없음 | ||
|
|
||
| **동작 변경 (코드 수정 불필요)** | ||
|
|
||
| - 렌더 구조 — `asChild`가 아니면 아이콘과 레이블이 `button`의 직계 자식이 아니라 내부 `span`의 자식으로 렌더링, `button > [data-part='icon']` 같은 직계 자식 선택자나 루트의 `justify-content`로 아이콘과 레이블을 배치하던 스타일은 확인 필요 | ||
|
Comment on lines
+14
to
+16
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. DOM 구조 변경을 소비처 마이그레이션으로 안내해 주세요. 기존
As per coding guidelines: “소비처 영향이 있으면 반드시
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { clsx } from "clsx"; | ||
|
|
||
| import * as styles from "./buttonSpinner.css"; | ||
| import type { IconSize } from "../../Icon"; | ||
| import { sizeMap } from "../../Icon/IconMap"; | ||
|
|
||
| interface ButtonSpinnerProps { | ||
| size: IconSize; | ||
| className?: string; | ||
| } | ||
|
|
||
| const ARC_PATH = "M8 2A6 6 0 0 1 13.638 5.948"; | ||
|
|
||
| export const ButtonSpinner = ({ size, className }: ButtonSpinnerProps) => { | ||
| const pixelSize = sizeMap[size]; | ||
|
|
||
| return ( | ||
| <svg | ||
| aria-hidden | ||
| data-part='spinner' | ||
| width={pixelSize} | ||
| height={pixelSize} | ||
| viewBox='0 0 16 16' | ||
| fill='none' | ||
| stroke='currentColor' | ||
| strokeWidth={2} | ||
| className={clsx(styles.root, className)} | ||
| > | ||
| <circle cx={8} cy={8} r={6} className={styles.track} /> | ||
| <path d={ARC_PATH} className={styles.tail} /> | ||
| <path d={ARC_PATH} className={styles.head} /> | ||
| </svg> | ||
| ); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { keyframes, style } from "@vanilla-extract/css"; | ||
| import { vars } from "tokens"; | ||
| import { overlayHoverOpacity, overlayPressedOpacity } from "utils"; | ||
|
|
||
| export const loadingRoot = style({ | ||
| selectors: { | ||
| "&[data-loading]": { | ||
| cursor: "progress", | ||
| vars: { | ||
| [overlayHoverOpacity]: "0", | ||
| [overlayPressedOpacity]: "0", | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export const buttonContent = style({ | ||
| display: "inline-flex", | ||
| alignItems: "center", | ||
| gap: "inherit", | ||
| selectors: { | ||
| "[data-loading] > &": { opacity: 0 }, | ||
| }, | ||
| }); | ||
|
|
||
| export const root = style({ | ||
| position: "absolute", | ||
| inset: 0, | ||
| margin: "auto", | ||
| pointerEvents: "none", | ||
| }); | ||
|
|
||
| export const track = style({ | ||
| opacity: `calc(${vars.scheme.semantic.opacity["29"]} / 100)`, | ||
| }); | ||
|
|
||
| const tailRotate = keyframes({ | ||
| "0%": { transform: "rotate(0deg)" }, | ||
| "50%": { transform: "rotate(360deg)" }, | ||
| "100%": { transform: "rotate(720deg)" }, | ||
| }); | ||
|
|
||
| const headRotate = keyframes({ | ||
| "0%": { transform: "rotate(0deg)" }, | ||
| "50%": { transform: "rotate(430deg)" }, | ||
| "100%": { transform: "rotate(720deg)" }, | ||
| }); | ||
|
|
||
| const arc = style({ | ||
| transformBox: "view-box", | ||
| transformOrigin: "50% 50%", | ||
| animationDuration: "2s", | ||
| animationTimingFunction: "ease", | ||
| animationIterationCount: "infinite", | ||
| }); | ||
|
|
||
| export const tail = style([arc, { animationName: tailRotate }]); | ||
|
|
||
| export const head = style([arc, { animationName: headRotate }]); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { ButtonSpinner } from "./ButtonSpinner"; | ||
| export { buttonContent, loadingRoot } from "./buttonSpinner.css"; |
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.
DOM 구조 변경의 마이그레이션을 제공하세요.
기존
button > [data-part='icon']선택자는 내부span추가 후 아이콘과 일치하지 않습니다. 이 경우 소비처가 CSS를 수정해야 하므로코드 수정 불필요분류와 맞지 않습니다.이 내용을
소비처 영향 (코드 수정 필요)섹션으로 옮기세요.AS-IS | TO-BE표와 선택자 수정 예시를 담은diff블록을 추가하세요.코딩 가이드라인의 “소비처 영향이 있으면 반드시
diff블록으로 보여준다”와 “제거되거나 이름이 바뀐 것을AS-IS | TO-BE2열 표로 보여준다” 규칙에 따른 요청입니다.Source: Coding guidelines