diff --git a/packages/components/src/dropdown-menu/dropdown-menu.tsx b/packages/components/src/dropdown-menu/dropdown-menu.tsx index fda0ee99..d07032ec 100644 --- a/packages/components/src/dropdown-menu/dropdown-menu.tsx +++ b/packages/components/src/dropdown-menu/dropdown-menu.tsx @@ -2,62 +2,16 @@ import { cloneElement } from 'react' import { DropdownMenuContent, - DropdownMenuItem as RadixDropdownMenuItem, + DropdownMenuItem, DropdownMenuSeparator, - // Label, Portal, Root, Trigger, } from '@radix-ui/react-dropdown-menu' -import { Stack, styled } from 'tamagui' +import { styled } from '@tamagui/core' import { Text } from '../text' -const Content = styled(DropdownMenuContent, { - name: 'DropdownMenuContent', - acceptsClassName: true, - - width: 352, - padding: 8, - borderRadius: 16, - backgroundColor: '$white-100', - - shadowRadius: 30, - shadowOffset: '0px 8px', - shadowColor: 'rgba(9, 16, 28, 0.12)', -}) - -const Item = styled(RadixDropdownMenuItem, { - name: 'DropdownMenuItem', - acceptsClassName: true, - - display: 'flex', - alignItems: 'center', - padding: 8, - borderRadius: 12, - cursor: 'pointer', - userSelect: 'none', - - hoverStyle: { - backgroundColor: '$neutral-5', - }, - - pressStyle: { - backgroundColor: '$neutral-10', - }, -}) - -const Separator = styled(DropdownMenuSeparator, { - name: 'DropdownMenuSeparator', - acceptsClassName: true, - - height: 1, - backgroundColor: '$neutral-10', - marginVertical: 8, - marginLeft: -8, - marginRight: -8, -}) - interface Props { children: [React.ReactElement, React.ReactElement] modal?: false @@ -84,24 +38,71 @@ interface DropdownMenuItemProps { danger?: boolean } -const DropdownMenuItem = (props: DropdownMenuItemProps) => { +const MenuItem = (props: DropdownMenuItemProps) => { const { icon, label, onSelect, danger } = props const iconColor = danger ? '$danger-50' : '$neutral-50' const textColor = danger ? '$danger-50' : '$neutral-100' return ( - - {cloneElement(icon, { color: iconColor })} + + {cloneElement(icon, { color: iconColor })} {label} - + ) } +const Content = styled(DropdownMenuContent, { + name: 'DropdownMenuContent', + acceptsClassName: true, + + width: 256, + padding: 4, + borderRadius: 12, + backgroundColor: '$white-100', + + shadowRadius: 30, + shadowOffset: '0px 8px', + shadowColor: 'rgba(9, 16, 28, 0.12)', +}) + +const ItemBase = styled(DropdownMenuItem, { + name: 'DropdownMenuItem', + acceptsClassName: true, + + display: 'flex', + alignItems: 'center', + height: 32, + paddingHorizontal: 8, + borderRadius: 10, + cursor: 'pointer', + userSelect: 'none', + gap: 8, + + hoverStyle: { + backgroundColor: '$neutral-5', + }, + + pressStyle: { + backgroundColor: '$neutral-10', + }, +}) + +const Separator = styled(DropdownMenuSeparator, { + name: 'DropdownMenuSeparator', + acceptsClassName: true, + + height: 1, + backgroundColor: '$neutral-10', + marginVertical: 4, + marginLeft: -4, + marginRight: -4, +}) + DropdownMenu.Content = Content -DropdownMenu.Item = DropdownMenuItem +DropdownMenu.Item = MenuItem DropdownMenu.Separator = Separator export { DropdownMenu } diff --git a/packages/components/src/topbar/topbar.tsx b/packages/components/src/topbar/topbar.tsx index d37afeb2..9e657081 100644 --- a/packages/components/src/topbar/topbar.tsx +++ b/packages/components/src/topbar/topbar.tsx @@ -129,7 +129,7 @@ const Topbar = (props: Props) => { } - label="View channel members and details" + label="View channel details" onSelect={() => console.log('click')} />