Skip to content

Commit

Permalink
[Bug] Leading & Trailing Visual Colors for Button (#3447)
Browse files Browse the repository at this point in the history
* updated leading and trailing visuals

* changed font size for Button Counter

* update tests

* Create strong-zoos-explain.md

* test(vrt): update snapshots

* add trailing action

* test(vrt): update snapshots

* fix trailing counter position

* snaps

* test(vrt): update snapshots

---------

Co-authored-by: langermank <18661030+langermank@users.noreply.github.com>
Co-authored-by: langermank <langermank@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 18, 2023
1 parent c02f3a2 commit 40808db
Show file tree
Hide file tree
Showing 244 changed files with 1,135 additions and 611 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-zoos-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

[Bug] Leading & Trailing Visual Colors for Button
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 34 additions & 139 deletions docs/package-lock.json

Large diffs are not rendered by default.

1,404 changes: 945 additions & 459 deletions examples/nextjs/package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/Button/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme
backgroundColor: 'btn.activeBg',
borderColor: 'btn.activeBorder',
},
'[data-component="leadingVisual"], [data-component="trailingVisual"], [data-component="trailingAction"]': {
color: 'fg.muted',
},
},
primary: {
color: 'btn.primary.text',
Expand Down Expand Up @@ -234,7 +237,7 @@ export const getBaseStyles = (theme?: Theme) => ({
},
},
'[data-component=ButtonCounter]': {
fontSize: '1',
fontSize: '0',
},
'&[data-component=IconButton]': {
display: 'inline-grid',
Expand Down Expand Up @@ -295,6 +298,9 @@ export const getButtonStyles = (theme?: Theme) => {
gridArea: 'text',
lineHeight: 'calc(20/14)',
whiteSpace: 'nowrap',
// remove flex in next major release
display: 'flex',
alignItems: 'center',
},
'[data-component="trailingVisual"]': {
gridArea: 'trailingVisual',
Expand Down
16 changes: 15 additions & 1 deletion src/__tests__/__snapshots__/ActionMenu.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ exports[`ActionMenu renders consistently 1`] = `
}
.c1 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
}
.c1[data-component=IconButton] {
Expand Down Expand Up @@ -178,6 +178,14 @@ exports[`ActionMenu renders consistently 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c1 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -223,6 +231,12 @@ exports[`ActionMenu renders consistently 1`] = `
border-color: rgba(31,35,40,0.15);
}
.c1 [data-component="leadingVisual"],
.c1 [data-component="trailingVisual"],
.c1 [data-component="trailingAction"] {
color: #656d76;
}
@media (forced-colors:active) {
.c1:focus {
outline: solid 1px transparent;
Expand Down
110 changes: 102 additions & 8 deletions src/__tests__/__snapshots__/Button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ exports[`Button renders consistently 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
}
.c0[data-component=IconButton] {
Expand Down Expand Up @@ -164,6 +164,14 @@ exports[`Button renders consistently 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -209,6 +217,12 @@ exports[`Button renders consistently 1`] = `
border-color: rgba(31,35,40,0.15);
}
.c0 [data-component="leadingVisual"],
.c0 [data-component="trailingVisual"],
.c0 [data-component="trailingAction"] {
color: #656d76;
}
@media (forced-colors:active) {
.c0:focus {
outline: solid 1px transparent;
Expand Down Expand Up @@ -329,7 +343,7 @@ exports[`Button respects block prop 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
}
.c0[data-component=IconButton] {
Expand Down Expand Up @@ -391,6 +405,14 @@ exports[`Button respects block prop 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -436,6 +458,12 @@ exports[`Button respects block prop 1`] = `
border-color: btn.activeBorder;
}
.c0 [data-component="leadingVisual"],
.c0 [data-component="trailingVisual"],
.c0 [data-component="trailingAction"] {
color: fg.muted;
}
@media (forced-colors:active) {
.c0:focus {
outline: solid 1px transparent;
Expand Down Expand Up @@ -562,7 +590,7 @@ exports[`Button respects the alignContent prop 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
}
.c0[data-component=IconButton] {
Expand Down Expand Up @@ -624,6 +652,14 @@ exports[`Button respects the alignContent prop 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -669,6 +705,12 @@ exports[`Button respects the alignContent prop 1`] = `
border-color: btn.activeBorder;
}
.c0 [data-component="leadingVisual"],
.c0 [data-component="trailingVisual"],
.c0 [data-component="trailingAction"] {
color: fg.muted;
}
@media (forced-colors:active) {
.c0:focus {
outline: solid 1px transparent;
Expand Down Expand Up @@ -794,7 +836,7 @@ exports[`Button respects the large size prop 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
}
.c0[data-component=IconButton] {
Expand Down Expand Up @@ -856,6 +898,14 @@ exports[`Button respects the large size prop 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -901,6 +951,12 @@ exports[`Button respects the large size prop 1`] = `
border-color: btn.activeBorder;
}
.c0 [data-component="leadingVisual"],
.c0 [data-component="trailingVisual"],
.c0 [data-component="trailingAction"] {
color: fg.muted;
}
@media (forced-colors:active) {
.c0:focus {
outline: solid 1px transparent;
Expand Down Expand Up @@ -1027,7 +1083,7 @@ exports[`Button respects the small size prop 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
}
.c0[data-component=IconButton] {
Expand Down Expand Up @@ -1089,6 +1145,14 @@ exports[`Button respects the small size prop 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -1134,6 +1198,12 @@ exports[`Button respects the small size prop 1`] = `
border-color: btn.activeBorder;
}
.c0 [data-component="leadingVisual"],
.c0 [data-component="trailingVisual"],
.c0 [data-component="trailingAction"] {
color: fg.muted;
}
@media (forced-colors:active) {
.c0:focus {
outline: solid 1px transparent;
Expand Down Expand Up @@ -1263,7 +1333,7 @@ exports[`Button styles danger button appropriately 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
color: btn.danger.counterFg;
background-color: btn.danger.counterBg;
}
Expand Down Expand Up @@ -1327,6 +1397,14 @@ exports[`Button styles danger button appropriately 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -1511,7 +1589,7 @@ exports[`Button styles invisible button appropriately 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
}
.c0[data-component=IconButton] {
Expand Down Expand Up @@ -1574,6 +1652,14 @@ exports[`Button styles invisible button appropriately 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down Expand Up @@ -1764,7 +1850,7 @@ exports[`Button styles primary button appropriately 1`] = `
}
.c0 [data-component=ButtonCounter] {
font-size: 14px;
font-size: 12px;
background-color: btn.primary.counterBg;
color: btn.primary.text;
}
Expand Down Expand Up @@ -1828,6 +1914,14 @@ exports[`Button styles primary button appropriately 1`] = `
grid-area: text;
line-height: calc(20/14);
white-space: nowrap;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c0 [data-component="trailingVisual"] {
Expand Down
Loading

0 comments on commit 40808db

Please sign in to comment.