-
Notifications
You must be signed in to change notification settings - Fork 117
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
Use ShadCN's DropdownMenu
in the Cloud UI
#3737
Conversation
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, digging it.
import { createPopperActions } from "svelte-popperjs"; | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuItem, |
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 a nit, but I think import * as DropdownMenu
and then accessing Content
, Root
, Trigger
, etc. keeps this a lot cleaner.
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.
Agreed, and just updated. I was relying on VSCode auto-imports, so I'm curious – would you do this import *
by hand, or do you happen to have a VSCode trick?
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 really great and solves a ton of little problems in one fell swoop. Added some comments about small implementation details.
web-admin/src/features/dashboards/share/ShareDashboardButton.svelte
Outdated
Show resolved
Hide resolved
Regarding your issue with the @ericpgreen2 Here's what I had to do to get it work: <DropdownMenuSub bind:open={subOpen} >
<DropdownMenuSubTrigger
disabled={true}
on:click={() => (subOpen = !subOpen)}>View as</DropdownMenuSubTrigger
>
<DropdownMenuSubContent
class="min-w-[150px] max-w-[300px] min-h-[150px] max-h-[190px] flex flex-col"
>
<ViewAsUserPopover
organization={$page.params.organization}
project={$page.params.project}
/>
</DropdownMenuSubContent>
</DropdownMenuSub> |
Oh, nice find. Works 👍 |
This PR follows #3736, which introduces the ShadCN
DropdownMenu
component set. This PR uses the new dropdown menu in the following places in the Cloud UI:Closes #3630
Note: In the user avatar menu, I'd prefer if the "View As" submenu opened on click rather than on hover. I think I'm blocked by a bug with controlled dropdown menus. I've opened up the following issue in ShadCN-Svelte: huntabyte/bits-ui#245