-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add isDestructive style to Button #22921
Add isDestructive style to Button #22921
Conversation
I don't understand how my change make the Travis CI test fail |
@ArnaudBan the test failure is unrelated, don't worry about it. Do you think you can add an example to the storybook buttons story? (run locally by doing |
@youknowriad Yes i can try that. I will update this PR when it's done. Thank you. |
@@ -194,7 +194,41 @@ | |||
|
|||
// Link buttons that are red to indicate destructive behavior. | |||
&.is-link.is-destructive { | |||
color: $alert-red; | |||
color: #b52727; |
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.
This is a new color, which is fine, but we should change the variable contents instead of adding a new color, that way all elements that reference $alert-red will benefit from the change, and the color will be consistent.
This picture shows the existing $alert-red in the top left corner, the new color you added in the bottom, and a suggestion on the right.
The existing alert red is a little soft. Your new color is better, but I wonder if there's a 3rd option, which I suggested on the right, it's a bit between them and with higher saturation. What do you think? That new color is #CC1818
} | ||
|
||
/** | ||
* Destructive buttons. |
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.
Nicely commented. I think we should use a single space instead of a tab between the asterisk and comment, i.e. * Destructive...
.
*/ | ||
|
||
&.is-destructive { | ||
color: #b52727; |
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.
These should all leverage the same $alert-red variable.
box-shadow: inset 0 0 0 $border-width #b52727; | ||
|
||
&:hover:not(:disabled) { | ||
color: #a02222; |
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.
What a wonderful PR, thank you! Things are looking generally good, and I left a few comments to use some variables instead. Let me know if that works for you! |
I'm having trouble with my dev environment and I can't, at the moment, test this PR. However, looking at the screenshot, it looks like in the isDestructuve hover state, the background stays the same color. @jasmussen I'm wondering if this should follow the WP component guidelines in Figma? Where the background gets sligthly darker. |
Sounds good to me! |
133ac44
to
bc6e3fe
Compare
@jasmussen Thank you for kind remark. I update the PR with le use of SASS variable and a change the $alert-red variable value. I also add a story for the Button component showing the isDestructive variante as @youknowriad suggest |
The new styles will break current buttons with Added a story in cf4fb78. |
cf4fb78
to
4529645
Compare
Thank you @ocean90 i had missed that my PR had broken the destructive link Button |
@jasmussen would you mind doing a final check here when you have time? |
This is what I see: Looks good, compared to secondary buttons too: Looking at the code, though, it repeated some styles that I believe it could inherit from .components-button, so I pushed a small tweak to reduce the code (a2a7a37), and it still looks good. Note that I didn't find anywhere in our block editor that currently uses this button style — so I inspected it into the save draft button. But the result should be the same. |
@youknowriad Everything looks good to me. Can we think about mergin this Pull Request now ? |
Sorry for missing this @ArnaudBan do you think you can rebase the PR? |
a2a7a37
to
c826426
Compare
@youknowriad I rebase and had to make some changes because variable color add been updated ( seem that you are now using css variable ) |
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. This is looking good.
Description
Fixes #18674.
Add style for button component with the isDestructive props. I follow the figma design find on the issue #18674
How has this been tested?
This is just adding style, not removing any. A did test by looking a the new style on my local instalation
Screenshots
isDestructive :
isDestructive hover :
isDestructive focus :
isDestructive active :
isDestructive disabled :
Types of changes
Add CSS Style
Checklist: