From ac4a20f6ddcaaaf00ec4204ed2e8956010857a06 Mon Sep 17 00:00:00 2001 From: Berci Kormendy Date: Mon, 15 Jul 2024 16:09:43 +0200 Subject: [PATCH] separator, margins, min-width --- .../component-picker-context-menu.tsx | 13 +++++++++++-- editor/src/uuiui/radix-components.tsx | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx b/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx index feb2cf92c365..bb71c657d688 100644 --- a/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx +++ b/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx @@ -94,6 +94,7 @@ import { DropdownItem, DropdownMenuContainer, DropdownMenuItemList, + Separator, } from '../../../uuiui/radix-components' import { ContextMenuWrapper_DEPRECATED } from '../../context-menu-wrapper' import type { ContextMenuItem } from '../../context-menu-items' @@ -975,7 +976,7 @@ export const ComponentPickerDropDown = React.memo( return ( <> -
----
+ ( } }, [allInsertableComponents, onItemClickFn, page, preferredChildItems, showFullPicker]) - return + return ( + + ) }) function contextMenuItemsFromVariants( diff --git a/editor/src/uuiui/radix-components.tsx b/editor/src/uuiui/radix-components.tsx index 93bae65d04a5..00564725b4b1 100644 --- a/editor/src/uuiui/radix-components.tsx +++ b/editor/src/uuiui/radix-components.tsx @@ -5,9 +5,15 @@ import { colorTheme } from './styles/theme' import { Icons } from './icons' import { when } from '../utils/react-conditionals' +export const Separator = styled('div', { + height: 1, + margin: 5, + backgroundColor: colorTheme.contextMenuSeparator.value, +}) + const DropdownMenuItemContainer = styled('div', { minWidth: 128, - padding: '4px 8px', + padding: '6px 8px', cursor: 'pointer', color: colorTheme.contextMenuForeground.value, '[data-highlighted] > &': { @@ -189,11 +195,14 @@ export const DropdownMenu = React.memo((props) => { e.stopPropagation() } }, []) + + const opener = React.useMemo(() => props.opener(open), [open, props]) + const onEscapeKeyDown = React.useCallback((e: KeyboardEvent) => e.stopPropagation(), []) return ( - {props.opener(open)} + {opener} void sideOffset?: number alignOffset?: number + style?: React.CSSProperties } export const DropdownMenuContainer = React.memo((props) => { @@ -252,6 +262,7 @@ export const DropdownMenuContainer = React.memo((pro collisionPadding={{ top: -4 }} align='start' alignOffset={props.alignOffset} + style={{ ...props.style }} > {props.contents}