Skip to content

Commit 86bb305

Browse files
committed
refactor(#49): disabled 상태 스타일 정의를 variant에서 base의 selectors로 변경
1 parent 5dde933 commit 86bb305

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/components/ui/Button/Button.css.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ export const button = recipe({
1010
fontWeight: 600,
1111
transition: "background-color 0.2s ease",
1212
whiteSpace: "nowrap",
13+
14+
selectors: {
15+
"&:disabled": {
16+
backgroundColor: colors.coolNeutral[96],
17+
color: colors.neutral[70],
18+
cursor: "not-allowed",
19+
},
20+
"&:disabled:hover": {
21+
backgroundColor: colors.coolNeutral[96],
22+
},
23+
},
1324
},
1425
variants: {
1526
variant: {
@@ -28,11 +39,6 @@ export const button = recipe({
2839
backgroundColor: colors.coolNeutral[99],
2940
":hover": { backgroundColor: colors.coolNeutral[97] },
3041
},
31-
disabled: {
32-
backgroundColor: colors.coolNeutral[96],
33-
color: colors.neutral[70],
34-
cursor: "not-allowed",
35-
},
3642
},
3743
size: {
3844
small: {

src/components/ui/Button/Button.stories.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ const meta: Meta<typeof Button> = {
2121
control: "select",
2222
options: ["small", "medium", "large", "fullWidth"],
2323
},
24+
disabled: {
25+
control: "boolean",
26+
},
2427
onClick: { action: "clicked" },
2528
},
2629
};
@@ -50,14 +53,6 @@ export const Assistive: Story = {
5053
},
5154
};
5255

53-
export const Disabled: Story = {
54-
args: {
55-
variant: "disabled",
56-
size: "medium",
57-
disabled: true,
58-
},
59-
};
60-
6156
export const Sizes: Story = {
6257
render: args => (
6358
<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>

src/components/ui/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ComponentPropsWithoutRef } from "react";
22

33
import { button } from "./Button.css";
44

5-
type ButtonVariant = "primary" | "dark" | "assistive" | "disabled";
5+
type ButtonVariant = "primary" | "dark" | "assistive";
66
type ButtonSize = "small" | "medium" | "large" | "fullWidth";
77

88
type ButtonProps = {

0 commit comments

Comments
 (0)