-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Button] add support for split disclosure button #2329
Conversation
af9fce8
to
3d87c48
Compare
I dig this new prop! |
35e9e22
to
f332529
Compare
f332529
to
11fdf55
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.
Looks good to me 👍
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.
Code and 🎩 look great. Thanks for taking this on!
src/components/Button/Button.scss
Outdated
|
||
.ConnectedDisclosureWrapper { | ||
display: flex; | ||
flex-wrap: nowrap; |
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.
nowrap
is the default so you might not need to specify here.
src/components/Button/Button.tsx
Outdated
|
||
const connectedDisclosureActivator = ( | ||
<button | ||
type={type} |
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.
I think we might be safer by typing this as button vs passing the prop.
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.
💯
@dleroux has some interesting stuff coming up that might allow us to do this split style with a ButtonGroup instead of a needing a new prop, you two should talk |
Thanks @BPScott! Dan reached out to me yesterday 👍 He's got some kinks to work out with the way the context works, but if it get's figured out and folks are on board with the asterisks then I'll end up closing this and opening a new PR adding a split button example to |
It’s now ready for review #2441 |
It's ready for review again and much simpler #2441 |
11fdf55
to
3939e9d
Compare
Hey @simon-callsen 👋, yes the |
71f96b4
to
98b1c03
Compare
98b1c03
to
3b48454
Compare
ff0b59f
to
4cd4d7a
Compare
@@ -201,6 +201,7 @@ | |||
border-color: rgba($outline-color, 0.4); | |||
box-shadow: none; | |||
color: darken($outline-color, 20%); | |||
@include recolor-icon(darken($outline-color, 20%)); |
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.
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.
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.
Hmmm, those screenshots are from the style guide, @mirualves is your screenshot an outline button or a monochrome button?
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.
My screenshot is from the outline monochrome button (style guide). I'm sorry for the late reply!
src/styles/shared/_buttons.scss
Outdated
@@ -247,6 +248,7 @@ | |||
background: transparent; | |||
box-shadow: 0 0 0 border-width('base') var(--p-critical-border); | |||
color: var(--p-critical-link); | |||
@include recolor-icon(var(--p-critical-link)); |
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.
Again, parity between destructive outline button icon and text colors. cc @jessebc and @mirualves
Before | After | |
---|---|---|
Light mode | ||
Dark mode |
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.
Yeah, the after makes sense to me. The contrast looks much better in both light and dark mode.
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.
👀 Just a random question, but why are the outline and the text for the dark mode button two separate colors?
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.
The short answer is for contrast ratios. But it is possible these colors will still be tweaked—at the moment it is more important the code is using the proper color role variable.
4cd4d7a
to
bd4cabe
Compare
Update locales/hi.json Update locales/pl.json Update locales/pt-PT.json Update locales/zh-TW.json Update locales/tr.json Update locales/zh-CN.json Update locales/th.json Update locales/da.json Update locales/es.json Update locales/fr.json Update locales/nl.json Update locales/ko.json Update locales/ja.json Update locales/pt-BR.json Update locales/sv.json Update locales/ms.json Update locales/cs.json Update locales/fi.json Update locales/nb.json Update locales/it.json
bd4cabe
to
8e03336
Compare
WHY are these changes introduced?
There is currently no way to expose merchants to related primary actions in the
ContextualSaveBar
orPage
Header
because they only support a single primary action. For example, if the primary action is to save a resource like an order, but you can also save the order as a draft.WHAT is this pull request doing?
This PR adds support for a split button variant. This is the same UX as the split button you are probably familiar with in Gmail. It renders a disclosure button connected right which toggles a popover action list with related actions.
Click to view other UX considered
Another possible UX could be that the action list acts as a way to choose which action the primary button renders. You may be familiar with that type of split button if you've ever created a draft PR here on GitHub. The currently selected action has a selected state in the action list. Clicking a related action closes the popover and updates the primary action to be that clicked action.
cc @ShaniqueS @mirualves
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
To tophat in Chroma deployment
To tophat locally
git checkout button-connectedSegment && dev up && yarn dev
polaris-react
in your text editor and copy/paste the Playground code collapsed below into/playground/Playground.tsx
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes