-
Notifications
You must be signed in to change notification settings - Fork 436
feat(clerk-js,clerk-react,types): Introduce UserButton custom menu items
#3784
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(clerk-js,clerk-react,types): Introduce UserButton custom menu items
#3784
Conversation
🦋 Changeset detectedLatest commit: 80e991f The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
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 |
|
!snapshot |
34f2f73 to
04b187b
Compare
|
!snapshot |
04b187b to
4ef610e
Compare
UserButton custom menu items
c8d5c5c to
48ca521
Compare
|
!snapshot |
6ee1d06 to
f41dbf6
Compare
UserButton custom menu itemsUserButton custom menu items
panteliselef
left a comment
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 did a first pass on it.
| if ( | ||
| !isThatComponent(child, PageComponent) && | ||
| !isThatComponent(child, LinkComponent) && | ||
| !isThatComponent(child, MenuItemsComponent) | ||
| ) { |
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.
❓ Do we allow for <UserProfile.MenuItems/> ? What's the reason we need this ?
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.
@panteliselef We can define custom pages through UserButton component and we need to allow MenuItems as children component.
For custom pages we use the useUserProfileCustomPages for both UserProfile and UserButton, maybe we should create 2 separate utils here in order to be able to determine the correct component and validate the component only if is it UserButton, wdyt?
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.
After our discussion, I confirm that this change is necessary. Regarding your question, this is definitely a good suggestion but nothing that needs to delay this PR any longer.
ee66c8b to
dcda643
Compare
|
!preview |
|
Hey @octoper, your preview is available.
|
4daf854 to
60da18f
Compare
anagstef
left a comment
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.
Amazing work! 💯 🚀
60da18f to
12ddd71
Compare
|
!snapshot |
|
Hey @nikospapcom - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@1.0.5-snapshot.v12ddd71 --save-exact
npm i @clerk/backend@1.5.0-snapshot.v12ddd71 --save-exact
npm i @clerk/chrome-extension@1.1.8-snapshot.v12ddd71 --save-exact
npm i @clerk/clerk-js@5.11.0-snapshot.v12ddd71 --save-exact
npm i @clerk/elements@0.10.8-snapshot.v12ddd71 --save-exact
npm i @clerk/clerk-expo@2.0.1-snapshot.v12ddd71 --save-exact
npm i @clerk/express@0.0.22-snapshot.v12ddd71 --save-exact
npm i @clerk/fastify@1.0.24-snapshot.v12ddd71 --save-exact
npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact
npm i @clerk/localizations@2.5.3-snapshot.v12ddd71 --save-exact
npm i @clerk/nextjs@5.2.9-snapshot.v12ddd71 --save-exact
npm i @clerk/clerk-react@5.3.0-snapshot.v12ddd71 --save-exact
npm i @clerk/remix@4.2.8-snapshot.v12ddd71 --save-exact
npm i @clerk/clerk-sdk-node@5.0.21-snapshot.v12ddd71 --save-exact
npm i @clerk/shared@2.4.2-snapshot.v12ddd71 --save-exact
npm i @clerk/tanstack-start@0.1.12-snapshot.v12ddd71 --save-exact
npm i @clerk/testing@1.2.4-snapshot.v12ddd71 --save-exact
npm i @clerk/themes@2.1.15-snapshot.v12ddd71 --save-exact
npm i @clerk/types@4.10.0-snapshot.v12ddd71 --save-exact |
12ddd71 to
49e0275
Compare
| if ( | ||
| !isThatComponent(child, PageComponent) && | ||
| !isThatComponent(child, LinkComponent) && | ||
| !isThatComponent(child, MenuItemsComponent) | ||
| ) { |
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.
After our discussion, I confirm that this change is necessary. Regarding your question, this is definitely a good suggestion but nothing that needs to delay this PR any longer.
packages/clerk-js/src/ui/components/UserButton/SessionActions.tsx
Outdated
Show resolved
Hide resolved
49e0275 to
821e3ec
Compare
821e3ec to
80e991f
Compare
Description
Introduce support for custom menu items in
<UserButton/>.<UserButton.MenuItems>as a child component to wrap custom menu items.<UserButton.Link/>for creating external or internal links.<UserButton.Action/>for opening a specific custom page of "UserProfile" or to trigger your own custom logic viaonClick.manageAccountandsignOutCustom Item
Custom Items and reordered default items
Multi-session with custom item
Multi-session custom items and reordered default items
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change