-
Notifications
You must be signed in to change notification settings - Fork 86
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
Sage/DSY-1746 Button Toggle styling changes #6217
Conversation
c6bea56
to
51bb52c
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d02e0cc:
|
f348b97
to
d87a932
Compare
e52d4ca
to
4bcc76b
Compare
src/components/button-toggle/button-toggle-group/button-toggle-group.component.tsx
Outdated
Show resolved
Hide resolved
src/components/button-toggle/button-toggle-group/button-toggle-group.component.tsx
Outdated
Show resolved
Hide resolved
src/components/button-toggle/button-toggle-group/button-toggle-group.stories.tsx
Outdated
Show resolved
Hide resolved
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.
We'll need to prevent the content jumping when the minor buttons are pressed/ activated
https://codesandbox.io/s/carbon-quickstart-forked-f82m7p?file=/src/App.js see for example of what I mean
var(--spacing100); | ||
} | ||
|
||
&:focus { |
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.
Comment: you don't need this as far as I can tell. You should style it using the aria-pressed=true
attribute similar to how it is achieved above. You'll also need to the padding imo as when the toggle button is active the increased border thickness will cause the layout to jump so the padding will need to be reduced when that happens to avoid it. Something like the below will work:
color: var(--colorsActionMinor500);
border: 1px solid var(--colorsActionMinor500);
&[aria-pressed="true"] {
border: 4px solid var(--colorsActionMinor500);
background-color: transparent;
padding: 0 ${paddingConfig[size] - 3}px;
:hover {
background-color: var(--colorsActionMinor600);
color: var(--colorsUtilityYang100);
border-color: var(--colorsActionMinor600);
}
}
:not([aria-pressed="true"]):not(:disabled):hover {
color: var(--colorsActionMinorYang100);
background-color: var(--colorsActionMinor600);
border-color: var(--colorsActionMinor600);
}
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.
https://codesandbox.io/s/carbon-quickstart-forked-f82m7p?file=/src/App.js
If you click one of the buttons you will see the content jumping
src/components/button-toggle/button-toggle-group/button-toggle-group.component.tsx
Outdated
Show resolved
Hide resolved
src/components/button-toggle/button-toggle-group/button-toggle-group.spec.tsx
Outdated
Show resolved
Hide resolved
db7feb9
to
eaa88d0
Compare
4c497ff
to
653f748
Compare
83d6d5b
to
c814b34
Compare
c814b34
to
08d3bc8
Compare
08d3bc8
0e253b6
to
08d3bc8
Compare
feat(button-toggle): rm variant prop feat(button-toggle): rm variant prop, tests feat(button-toggle): fix ts errors feat(button-toggle): update snaps feat(button-toggle): rm variant prop
08d3bc8
to
864f005
Compare
🎉 This PR is included in version 124.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Proposed behaviour
New Styling Added to Button Toggle component
Current behaviour
New Styling added to Button Toggle
Checklist
d.ts
file added or updated if requiredQA
Additional context
Testing instructions
The following CodeSandbox is an example of the broken behaviour.
You can see the new behaviour by looking at the version in the comment by
codesandbox[bot]
.