Skip to content

Commit 4dd4a08

Browse files
committed
Add disabled styles to counter and add storybook
1 parent 842018e commit 4dd4a08

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

src/Button/Button2.stories.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ export default {
2525
type: 'radio',
2626
options: ['small', 'medium', 'large']
2727
}
28+
},
29+
disabled: {
30+
control: {
31+
type: 'boolean',
32+
default: false
33+
}
2834
}
2935
}
3036
} as Meta
@@ -151,9 +157,16 @@ export const blockButton = ({...args}: ButtonProps) => {
151157
)
152158
}
153159

154-
export const disabledButton = ({...args}: ButtonProps) => {
160+
export const DisabledButton = ({...args}: ButtonProps) => {
161+
const [count, setCount] = useState(0)
155162
return (
156163
<>
164+
<Box mb={2}>
165+
<Button disabled onClick={() => setCount(count + 1)} {...args}>
166+
Watch
167+
<Button.Counter>{count}</Button.Counter>
168+
</Button>
169+
</Box>
157170
<Box mb={2}>
158171
<Button disabled {...args}>
159172
Disabled

src/Button/styles.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
2222
},
2323
'&:disabled': {
2424
color: 'primer.fg.disabled',
25-
backgroundColor: 'btn.disabledBg'
25+
backgroundColor: 'btn.disabledBg',
26+
'[data-component="ButtonCounter"]': {
27+
backgroundColor: 'btn.disableBg',
28+
color: 'primer.fg.disabled'
29+
}
2630
},
2731
'&[aria-expanded=true]': {
2832
backgroundColor: 'btn.activeBg',
@@ -48,7 +52,10 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
4852
},
4953
'&:disabled': {
5054
color: 'btn.primary.disabledText',
51-
backgroundColor: 'btn.primary.disabledBg'
55+
backgroundColor: 'btn.primary.disabledBg',
56+
'[data-component="ButtonCounter"]': {
57+
color: 'btn.primary.disabledText'
58+
}
5259
},
5360
'[data-component="ButtonCounter"]': {
5461
backgroundColor: 'btn.primary.counterBg',
@@ -89,6 +96,7 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
8996
backgroundColor: 'btn.danger.disabledBg',
9097
borderColor: 'btn.danger.disabledBorder',
9198
'[data-component="ButtonCounter"]': {
99+
color: 'btn.danger.disabledText',
92100
backgroundColor: 'btn.danger.disabledCounterBg'
93101
}
94102
},
@@ -119,7 +127,10 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
119127
backgroundColor: 'btn.selectedBg'
120128
},
121129
'&:disabled': {
122-
color: 'primer.fg.disabled'
130+
color: 'primer.fg.disabled',
131+
'[data-component="ButtonCounter"]': {
132+
color: 'primer.fg.disabled'
133+
}
123134
},
124135
'&[aria-expanded=true]': {
125136
backgroundColor: 'btn.selectedBg'
@@ -159,7 +170,8 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
159170
backgroundColor: 'btn.outline.disabledBg',
160171
borderColor: 'btn.border',
161172
'[data-component="ButtonCounter"]': {
162-
backgroundColor: 'btn.outline.disabledCounterBg'
173+
backgroundColor: 'btn.outline.disabledCounterBg',
174+
color: 'btn.outline.disabledText'
163175
}
164176
},
165177
'[data-component="ButtonCounter"]': {

0 commit comments

Comments
 (0)