-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Button] Add pressed state to #2148
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
Conversation
0c5d80a to
73a0144
Compare
|
Slight delay - Waiting to pair with a designer to hammer out visual states |
src/components/Button/Button.tsx
Outdated
| ariaExpanded?: boolean; | ||
| /** Tells screen reader the element is pressed */ | ||
| /** | ||
| * @deprecated As of release 4.X.X, replaced by {@link https://polaris.shopify.com/components/structure/page#props-pressed} |
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.
TODO: Edit this while merging
5bcf841 to
501480f
Compare
src/styles/shared/_buttons.scss
Outdated
| @mixin button-outline($outline-color) { | ||
| background: transparent; | ||
| @mixin button-filled-pressed($button-color, $focus-color) { | ||
| background: linear-gradient( |
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.
Grabbed styles from ToggleButton in web
cd00ac5 to
cde0f3b
Compare
|
Hey @AndrewMusgrave, can we hold off on this until after we make the changes with CSS custom properties and theming in the next few months? Otherwise, let’s pair on reworking this mixin to avoid color manipulation as it makes the code for backwards compatibility kind of gross. Thanks! |
danrosenthal
left a comment
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.
Can you add an example so folks can easily tophat this change and see it in use in our documentation once it's released?
|
I got tagged as this is modifying the public sass API. Eventually we want to stop touching that but we've not got the time to bash out that plan. The change to that looks fine for now. Removing myself from review as I haven't got the time to look at the rest of this |
A few months is a little bit longer to let this go stale, I'll remove all the sass manipulation 😄
Good call, I'll include an example. There are a lot of button variants though. The PR description has a complex playground to see the pressed states for 🎩 @mirualves Want to spend a few minutes going over the visuals Monday for a final check? |
cde0f3b to
2e43b2c
Compare
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.
Didn’t do a full review, but giving an approval for the sass variable approach, thanks for doing that!
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.
Thanks for the color notes!
Make sure there's a test passing the pressed property and this should be good to go.
4d1305c to
66aa609
Compare
I added a few tests. Historically we haven't tested visuals, is this something we're starting to do? @danrosenthal I moved the new mixings into |
It's not so much about testing visuals, as it is just having coverage on all code paths. I'd even be fine with adding
Fantastic! |
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.
🎉 Small suggestion on the api documentation, but looks good!
src/components/Button/Button.tsx
Outdated
| textAlign?: TextAlign; | ||
| /** Gives the button a subtle alternative to the default button styling, appropriate for certain backdrops */ | ||
| outline?: boolean; | ||
| /** Demonstrates a pressed state */ |
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.
| /** Demonstrates a pressed state */ | |
| /** Gives the button the appearance of being pressed */ |
8adbb3b to
6e2e4da
Compare
WHY are these changes introduced?
Fixes #877
WHAT is this pull request doing?
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx:🎩 checklist
README.mdwith documentation changes