Upgrade react-zen and migrate UI components to its updated APIs

This commit is contained in:
Mike Cao committed 2026-07-30 22:35:20 -07:00
1 parent f054830292
commit 6ac2b9377c
83 files changed
+1337 -506

No files matched your search

+17 -4
View File
@@ -1,5 +1,12 @@
import { Button, DialogTrigger, Icon, Menu, Popover } from '@umami/react-zen';
import type { Key, ReactNode } from 'react';
import {
Children,
cloneElement,
isValidElement,
type Key,
type ReactElement,
type ReactNode,
} from 'react';
import { Ellipsis } from '@/components/icons';
export function MenuButton({
@@ -22,9 +29,15 @@ export function MenuButton({
<Ellipsis />
</Icon>
</Button>
<Popover placement="bottom start">
<Menu aria-label="menu" onAction={handleAction} style={{ minWidth: '140px' }}>
{children}
<Popover side="bottom" align="start">
<Menu aria-label="menu" style={{ minWidth: '140px' }}>
{Children.map(children, child =>
isValidElement(child)
? cloneElement(child as ReactElement<{ onAction?: (key: Key) => void }>, {
onAction: handleAction,
})
: child,
)}
</Menu>
</Popover>
</DialogTrigger>