-
Notifications
You must be signed in to change notification settings - Fork 564
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
SelectPanel: Update SelectPanel to use modern ActionList #4794
Conversation
🦋 Changeset detectedLatest commit: 0b57206 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
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.
Awesome, nice work! As far as groups go, it looks like both the beta and deprecated versions of ActionList
support them. Maybe we could create a sub-component called MappedActionListGroup
? Then we could do something like:
function MappedActionListGroup({ items, header }: GroupProps) {
return (
<ActionList.Group>
<ActionList.GroupHeading variant={header.variant}>
{header.title}
</ActionList.GroupHeading>
{items.map((item) => <MappedActionList item={item}>)}
</ActionList.Group>
)
}
text, | ||
variant, | ||
disabled, | ||
trailingVisual: TrailingVisual, |
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'm not sure if this is a common pattern, but I personally find it a bit confusing to use TitleCase for these renamed variables. Can we avoid renaming them, or name them something else, eg. originalTrailingVisual
?
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 TitleCase is so that we can render them as a component in JSX
prop accepted as leadingVisual
, rendered in the body as <LeadingVisual/>
, it would have been nicer if the prop was already TitleCased to signal that it accepts a component (and not a string, for example), but probably not the correct time to change that here
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.
LGTM! Just had a question
if (activeDescendantRef.current && scrollContainerRef.current) { | ||
scrollIntoView(activeDescendantRef.current, scrollContainerRef.current, {...menuScrollMargins, behavior: 'auto'}) | ||
} | ||
}, [items]) |
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.
Is items
a memoized value or is a plain value typically?
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.
They are memoized in SelectPanel before passing to FilteredActionList. Tell me more?
Also wanted to leave a question, would it be possible for this to go in the next release batch? (I think it would be rc.5) Would help out a ton on my end, the release is starting to get big 😅 |
Absolutely! I can wait :) Update: rc.4 was merged yesterday, can merge this now 🎉 |
So happy to see this is merged!! Thanks @siddharthkp 🥹 💖 |
Note
New feature flag introduced: primer_react_select_panel_with_modern_action_list
What's changed
This is a pretty scary PR to roll out as it is replacing ActionList used internally in SelectPanel, that is why we are putting everything behind a feature flag (see FilteredActionList "entry file").
Rollout strategy
Merge checklist
Integration tests: