-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Modal: add headerActions
prop to render buttons in the header
#53328
Conversation
92566c7
to
d3fb67e
Compare
Thanks for the review, @ramonjd!
How about using only the Then, it might be better to have a gap of about 8px between the buttons: Also, when in mobile view, the modal is always in full screen, so it is better to hide this button Another approach is to make the Classic Editor modal full-screen from the start, instead of switching to full-screen status. When a user presses the Edit button in the Classic block, would they be surprised to see a large modal? 🤔 I would like to hear other opinions on this point. |
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 should tweak the architecture a bit. Are we expecting this "full screen mode" modal to have different styling, depending on the use case? I'm asking because in the example, the styling is added via the block-library
package.
We either want the fullscreen styling built into the Modal component itself, or else support this feature in a more generic way. For example, we could enhance Modal so that a consumer can inject auxiliary buttons next to the Close button. Then, the Freeform block would inject a Fullscreen button, and do its own styling via the className
prop.
What do you think?
I suppose that's a possibility. The freeform block does overwrite the modal styles (
Oh yeah, that's an interesting idea. Thanks! I wasn't too sure about this one when I pushed it so I'll play around. 🙇🏻
Good ideas, thank you! |
I was thinking about this. What's the preferred way of defining these props? Do we need to be strict about what is passed? I had started with a simple <Modal
auxiliaryActions={ <ButtonGroup /> }
/> But I suppose there's also the option of reining it into an array of <Modal
auxiliaryActions={ [
{
...someButtonProps,
}
] }
/> |
d3fb67e
to
a04be14
Compare
With |
I've added a TODO to add a story once we've decided on an approach. 👍🏻 |
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 testing very nicely for me!
2023-08-08.16.24.57.mp4
In terms of naming, I don't feel too strongly about it, but I was wondering if secondaryActions
might work? Mostly because auxiliary
can be hard to spell 😄. On the other hand, since there's no primary
or actions
prop, maybe auxiliary
is better.
Anyway, the injection and story all look good to me, looks like the changelog file might need a rebase, but once there's consensus on the naming, this one LGTM! ✨
81aa3c5
to
f5beb6e
Compare
Thanks @andrewserong You know, I probably had to fix my own typos about 20 times when typing it out. 😆 I'm also agnostic here. 'complementary'? |
Oh, that could work, too. And I only see one typo for |
Nice find! I couldn't help myself 😄 |
|
I like Just flagging hat we have |
You got it!!! 👍🏻
If you think we should, for sure. I can do a follow up PR because it might involve extricating it from the
|
True. I guess those components need to contain the |
headerActions
prop to render buttons in the header
f5beb6e
to
a29a81a
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.
Thanks for re-testing @andrewserong 🙇🏻 I'll let this PR stew overnight in case there's further feedback and merge tomorrow. |
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.
Btw I just noticed that Storybook isn't showing TypeScript data in the props tables anymore 😬 Something must have broke at some point. We'll look into that.
@@ -194,6 +194,13 @@ If this property is true, it will focus the first tabbable element rendered in t | |||
- Required: No | |||
- Default: `true` | |||
|
|||
#### headerActions |
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 this name is good too 👍 We should definitely have "header" in the name. For a moment I thought maybe "extras" instead of "actions" would be more accurately generic. But on the other hand I think it's good to restrict/suggest that it's intended for button-ish actions, just for the sake of UI design consistency.
Looking at this a bit more closely, |
Oh right I've mixed |
Added a dev note |
Thanks @ciampo 🙇🏻 |
What?
Not sure about this one yet. I would value some input 🙇🏻
This is an experiment to add a new prop
headerActions: ReacNode
to the<Modal />
component.The prop allows folks to inject buttons and other elements into the header.
Why?
See: #53258 (comment)
Some folks working in the classic block require things to be roomier, and it'd be nice to be able to toggle fullscreen mode in the modal. Why? There might be a lot of complex content in there, for which it would be helpful to have more real estate to work.
How?
Adding a new prop.
TODO
Testing Instructions
A good place to test this is by applying the new prop to the Class block modal:
Example diff
Also checkout the Story Book variation:
npm run storybook:dev
Screenshots or screencast
2023-08-07.11.40.12.mp4
2023-08-09.11.09.01.mp4
✍️ Dev note
Thanks to a new headerActions prop, consumers of Modal can inject buttons (and other elements) into the Modal's header, next to the close button.