Skip to content

Commit edab60b

Browse files
samejrmatt-aitken
authored andcommitted
Add secondary variant style to the triple dot menu
1 parent 686d918 commit edab60b

2 files changed

Lines changed: 37 additions & 7 deletions

File tree

  • apps/webapp/app
    • components/primitives
    • routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.metrics.custom.$dashboardId

apps/webapp/app/components/primitives/Popover.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,20 +243,41 @@ function PopoverArrowTrigger({
243243
);
244244
}
245245

246+
const popoverVerticalEllipseVariants = {
247+
minimal: {
248+
trigger:
249+
"size-6 rounded-[3px] text-text-dimmed hover:bg-tertiary hover:text-text-bright",
250+
icon: "size-5",
251+
},
252+
secondary: {
253+
trigger:
254+
"size-6 rounded border border-charcoal-600 bg-secondary text-text-bright hover:bg-charcoal-600 hover:border-charcoal-550",
255+
icon: "size-4",
256+
},
257+
} as const;
258+
259+
type PopoverVerticalEllipseVariant = keyof typeof popoverVerticalEllipseVariants;
260+
246261
function PopoverVerticalEllipseTrigger({
247262
isOpen,
263+
variant = "minimal",
248264
className,
249265
...props
250-
}: { isOpen?: boolean } & React.ComponentPropsWithoutRef<typeof PopoverTrigger>) {
266+
}: {
267+
isOpen?: boolean;
268+
variant?: PopoverVerticalEllipseVariant;
269+
} & React.ComponentPropsWithoutRef<typeof PopoverTrigger>) {
270+
const styles = popoverVerticalEllipseVariants[variant];
251271
return (
252272
<PopoverTrigger
253273
{...props}
254274
className={cn(
255-
"group flex items-center justify-end gap-1 rounded-[3px] p-0.5 text-text-dimmed transition focus-custom hover:bg-tertiary hover:text-text-bright",
275+
"group flex items-center justify-center transition focus-custom",
276+
styles.trigger,
256277
className
257278
)}
258279
>
259-
<EllipsisVerticalIcon className={cn("size-5 transition group-hover:text-text-bright")} />
280+
<EllipsisVerticalIcon className={cn(styles.icon, "transition group-hover:text-text-bright")} />
260281
</PopoverTrigger>
261282
);
262283
}

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.metrics.custom.$dashboardId/route.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,12 @@ export default function Page() {
362362
Add chart
363363
</Button>
364364
<Popover>
365-
<PopoverVerticalEllipseTrigger />
365+
<PopoverVerticalEllipseTrigger variant="secondary" />
366366
<PopoverContent className="w-fit min-w-[10rem] p-1" align="end">
367-
<RenameDashboardDialog title={title} />
368-
<DeleteDashboardDialog title={title} />
367+
<div className="flex flex-col gap-1">
368+
<RenameDashboardDialog title={title} />
369+
<DeleteDashboardDialog title={title} />
370+
</div>
369371
</PopoverContent>
370372
</Popover>
371373
</PageAccessories>
@@ -445,7 +447,14 @@ function RenameDashboardDialog({ title }: { title: string }) {
445447
return (
446448
<Dialog open={isOpen} onOpenChange={setIsOpen}>
447449
<DialogTrigger asChild>
448-
<Button variant="small-menu-item" LeadingIcon={IconEdit} fullWidth textAlignLeft>
450+
<Button
451+
variant="small-menu-item"
452+
LeadingIcon={IconEdit}
453+
fullWidth
454+
textAlignLeft
455+
className="pl-0.5 pr-3"
456+
leadingIconClassName="gap-x-0"
457+
>
449458
Rename dashboard
450459
</Button>
451460
</DialogTrigger>

0 commit comments

Comments
 (0)