-
Notifications
You must be signed in to change notification settings - Fork 446
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
feat(core): new insert menu for arrays with filtering, type preview support #6853
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
f9d830f
to
4c5b681
Compare
No changes to documentation |
Component Testing Report Updated Jun 17, 2024 9:47 AM (UTC)
|
2ead8c3
to
4354513
Compare
ad03dc7
to
39f0639
Compare
popoverProps: { | ||
placement: 'bottom', | ||
fallbackPlacements: ['top'], | ||
matchReferenceWidth: props.schemaType.options?.insertMenu?.filter === 'on', |
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.
@mariuslundgard, @rexxars , I think this logic is a tiny bit flawed now that we have auto-filtering. The original idea was to make the width of the menu match the button if filtering was turned on, but we can't infer from the outside that the menu decides to auto-enable filtering.
But now we might need
- An alternate way to infer full width
- A way for the menu to tell the call site that filtering is enabled
What do you think?
Array input with no insert menu options configured:
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'll defer to @mariuslundgard :)
Description
Instead of using a
MenuButton
the "array of objects" now renders the insertmenu using the
InsertMenu
from the new@sanity/insert-menu
package. Thisinsert menu allows more configuration in the form of
InsertMenuOptions
whichare exposed on the
ArrayOptions
interface.These are the options available:
And this if how they are made available:
If you enable
filter
, add somegroups
and addgrid
andlist
views then you end up with something like this:Instead of the usual:
(You can play around with the options in the
page-building-studio
)The options still don't take effect in the context menu:
This is implemented in #6921
What to review
What's most important is that no existing functionality breaks. We are releasing this as
@alpha
to try it out internally before start promoting the new options.Testing
I could definitely look into writing some tests for this. Let me know if you think this is a blocker for merging. I just didn't want to spend the time until the API/behaviour was somewhat decided upon.This PR adds a test for the multi-type array field to make sure the existing insert menu still works 🎉Notes for release