Skip to content

Commit 6f2340c

Browse files
authored
Button counter contrast fixes (#3270)
* bump primies * update counter colors * Create breezy-fireants-tickle.md * bump again * snaps * add story to e2e * bump * snippy snaps
1 parent 102ea81 commit 6f2340c

File tree

8 files changed

+168
-73
lines changed

8 files changed

+168
-73
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Button counter contrast fixes

package-lock.json

Lines changed: 7 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"@lit-labs/react": "1.1.1",
9797
"@primer/behaviors": "1.3.3",
9898
"@primer/octicons-react": "^18.0.0",
99-
"@primer/primitives": "7.11.7",
99+
"@primer/primitives": "7.11.10",
100100
"@react-aria/ssr": "^3.1.0",
101101
"@styled-system/css": "^5.1.5",
102102
"@styled-system/props": "^5.1.5",

script/generate-e2e-tests.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ const components = new Map([
242242
id: 'components-button-features--trailing-visual',
243243
name: 'Trailing Visual',
244244
},
245+
{
246+
id: 'components-button-features--trailing-counter-all-variants',
247+
name: 'Trailing Counter All Variants',
248+
},
245249
],
246250
},
247251
],

src/Button/Button.features.stories.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,54 @@ export const TrailingCounter = () => {
2828
)
2929
}
3030

31+
export const TrailingCounterAllVariants = () => {
32+
const [count, setCount] = useState(0)
33+
return (
34+
<div style={{display: 'flex', flexDirection: 'row', gap: '1rem'}}>
35+
<Button onClick={() => setCount(count + 1)}>
36+
Watch
37+
<Button.Counter>{count}</Button.Counter>
38+
</Button>
39+
<Button disabled onClick={() => setCount(count + 1)}>
40+
Watch
41+
<Button.Counter>{count}</Button.Counter>
42+
</Button>
43+
<Button variant="primary" onClick={() => setCount(count + 1)}>
44+
Watch
45+
<Button.Counter>{count}</Button.Counter>
46+
</Button>
47+
<Button variant="primary" disabled onClick={() => setCount(count + 1)}>
48+
Watch
49+
<Button.Counter>{count}</Button.Counter>
50+
</Button>
51+
<Button variant="outline" onClick={() => setCount(count + 1)}>
52+
Watch
53+
<Button.Counter>{count}</Button.Counter>
54+
</Button>
55+
<Button variant="outline" disabled onClick={() => setCount(count + 1)}>
56+
Watch
57+
<Button.Counter>{count}</Button.Counter>
58+
</Button>
59+
<Button variant="danger" onClick={() => setCount(count + 1)}>
60+
Watch
61+
<Button.Counter>{count}</Button.Counter>
62+
</Button>
63+
<Button variant="danger" disabled onClick={() => setCount(count + 1)}>
64+
Watch
65+
<Button.Counter>{count}</Button.Counter>
66+
</Button>
67+
<Button variant="invisible" onClick={() => setCount(count + 1)}>
68+
Watch
69+
<Button.Counter>{count}</Button.Counter>
70+
</Button>
71+
<Button variant="invisible" disabled onClick={() => setCount(count + 1)}>
72+
Watch
73+
<Button.Counter>{count}</Button.Counter>
74+
</Button>
75+
</div>
76+
)
77+
}
78+
3179
export const TrailingAction = () => <Button trailingAction={TriangleDownIcon}>Trailing action</Button>
3280

3381
export const Block = () => <Button block>Default</Button>

src/Button/styles.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
7272
boxShadow: `${theme?.shadows.btn.danger.hoverShadow}`,
7373
'[data-component=ButtonCounter]': {
7474
backgroundColor: 'btn.danger.hoverCounterBg',
75-
color: 'btn.danger.hoverText',
75+
color: 'btn.danger.hoverCounterFg',
7676
},
7777
},
7878
'&:active:not([disabled])': {
@@ -86,12 +86,12 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
8686
backgroundColor: 'btn.danger.disabledBg',
8787
borderColor: 'btn.danger.disabledBorder',
8888
'[data-component=ButtonCounter]': {
89-
color: 'inherit',
89+
color: 'btn.danger.disabledCounterFg',
9090
backgroundColor: 'btn.danger.disabledCounterBg',
9191
},
9292
},
9393
'[data-component=ButtonCounter]': {
94-
color: 'btn.danger.text',
94+
color: 'btn.danger.counterFg',
9595
backgroundColor: 'btn.danger.counterBg',
9696
},
9797
'&[aria-expanded=true]': {
@@ -156,7 +156,7 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
156156
boxShadow: `${theme?.shadows.btn.outline.hoverShadow}`,
157157
'[data-component=ButtonCounter]': {
158158
backgroundColor: 'btn.outline.hoverCounterBg',
159-
color: 'inherit',
159+
color: 'btn.outline.hoverCounterFg',
160160
},
161161
},
162162
'&:active:not([disabled])': {
@@ -172,12 +172,12 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
172172
borderColor: 'btn.border',
173173
'[data-component=ButtonCounter]': {
174174
backgroundColor: 'btn.outline.disabledCounterBg',
175-
color: 'inherit',
175+
color: 'btn.outline.disabledCounterFg',
176176
},
177177
},
178178
'[data-component=ButtonCounter]': {
179179
backgroundColor: 'btn.outline.counterBg',
180-
color: 'btn.outline.text',
180+
color: 'btn.outline.counterFg',
181181
},
182182
'&[aria-expanded=true]': {
183183
color: 'btn.outline.selectedText',

src/__tests__/__snapshots__/Button.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,13 +1258,13 @@ exports[`Button styles danger button appropriately 1`] = `
12581258
}
12591259
12601260
.c0:disabled [data-component=ButtonCounter] {
1261-
color: inherit;
1261+
color: btn.danger.disabledCounterFg;
12621262
background-color: btn.danger.disabledCounterBg;
12631263
}
12641264
12651265
.c0 [data-component=ButtonCounter] {
12661266
font-size: 14px;
1267-
color: btn.danger.text;
1267+
color: btn.danger.counterFg;
12681268
background-color: btn.danger.counterBg;
12691269
}
12701270
@@ -1366,7 +1366,7 @@ exports[`Button styles danger button appropriately 1`] = `
13661366
13671367
.c0:hover:not([disabled]) [data-component=ButtonCounter] {
13681368
background-color: btn.danger.hoverCounterBg;
1369-
color: btn.danger.hoverText;
1369+
color: btn.danger.hoverCounterFg;
13701370
}
13711371
13721372
.c0:active:not([disabled]) {

0 commit comments

Comments
 (0)