Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

style(projects): update project create dropdown (#3449)

Seamusebf00a21ab0e
diff --git a/js/app/packages/block-project/component/ProjectCreateMenu.tsx b/js/app/packages/block-project/component/ProjectCreateMenu.tsx
index 1301f43146..142ed387d1 100644
--- a/js/app/packages/block-project/component/ProjectCreateMenu.tsx
+++ b/js/app/packages/block-project/component/ProjectCreateMenu.tsx
@@ -1,7 +1,7 @@
import type { BlockTool } from '@app/component/ResponsiveBlockToolbar';
import { useSplitLayout } from '@app/component/split-layout/layout';
import type { BlockAlias, BlockName } from '@core/block';
-import { EntityIcon, getIconConfig } from '@core/component/EntityIcon';
+import { EntityIcon } from '@core/component/EntityIcon';
import {
PROPERTY_OPTION_IDS,
SYSTEM_PROPERTY_IDS,
@@ -15,17 +15,15 @@ import {
createMarkdownFile,
createTask,
} from '@core/util/create';
-import { DropdownMenu } from '@kobalte/core/dropdown-menu';
+import CaretDown from '@phosphor/caret-down.svg';
import PlusIcon from '@phosphor/plus.svg';
+import CirclePlus from '@phosphor/plus-circle.svg';
import { createProject } from '@queries/storage/projects';
-import { Button, cn, Dialog, Layer, Surface } from '@ui';
+import { Dialog, Dropdown, Surface } from '@ui';
import { type Component, createSignal, For } from 'solid-js';
type MenuItemProps = {
label: string;
- blockName: BlockName | BlockAlias;
- index?: number;
- hotkeyToken: HotkeyToken;
Icon: Component;
action: () => void | Promise<void>;
};
@@ -254,23 +252,13 @@ function ProjectCreateDialog(props: {
}
function MenuItem(props: MenuItemProps) {
- const selectedColor = getIconConfig(props.blockName).foreground;
-
return (
- <DropdownMenu.Item
- class={cn(
- 'flex justify-between items-center gap-12 px-1.5 py-1 text-sm isolate transition-transform ease-out duration-200 text-ink-extra-muted outline-none data-highlighted:bg-active',
- `data-highlighted:${selectedColor}`
- )}
- onSelect={props.action}
- >
- <div class="flex items-center gap-1">
- <div class="size-4">
- <props.Icon />
- </div>
- <span>{props.label}</span>
+ <Dropdown.Item onSelect={props.action}>
+ <div class="size-4 shrink-0">
+ <props.Icon />
</div>
- </DropdownMenu.Item>
+ <span>{props.label}</span>
+ </Dropdown.Item>
);
}
@@ -280,8 +268,6 @@ function MenuContent(props: { projectId: string }) {
const items: MenuItemProps[] = BLOCK_CREATE_SPECS.map((spec) => ({
label: spec.label,
- blockName: spec.blockName,
- hotkeyToken: spec.hotkeyToken,
Icon: spec.icon,
action: () =>
createBlock({
@@ -292,11 +278,11 @@ function MenuContent(props: { projectId: string }) {
}));
return (
- <DropdownMenu.Content class="isolate relative flex flex-col gap-2 bg-surface -mb-1 p-2 border-2 border-accent min-w-max">
- <For each={items}>
- {(item, index) => <MenuItem {...item} index={index() + 1} />}
- </For>
- </DropdownMenu.Content>
+ <Dropdown.Content class="min-w-max">
+ <Dropdown.Group>
+ <For each={items}>{(item) => <MenuItem {...item} />}</For>
+ </Dropdown.Group>
+ </Dropdown.Content>
);
}
@@ -333,19 +319,20 @@ export function useProjectCreateTools(
export function ProjectCreateMenu(props: { id: string }) {
const [open, setOpen] = createSignal(false);
return (
- <DropdownMenu open={open()} onOpenChange={setOpen}>
+ <Dropdown open={open()} onOpenChange={setOpen}>
<div class="flex items-center">
- <DropdownMenu.Trigger class="h-min">
- <Button size="sm" variant={open() ? 'active' : 'base'}>
- Create
- </Button>
- </DropdownMenu.Trigger>
+ <Dropdown.Trigger
+ variant="base"
+ size="sm"
+ class="bg-surface py-3"
+ depth={2}
+ >
+ <CirclePlus />
+ Create
+ <CaretDown />
+ </Dropdown.Trigger>
</div>
- <DropdownMenu.Portal>
- <Layer depth={2}>
- <MenuContent projectId={props.id} />
- </Layer>
- </DropdownMenu.Portal>
- </DropdownMenu>
+ <MenuContent projectId={props.id} />
+ </Dropdown>
);
}
diff --git a/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
index 6ef3d2b713..f8d292d9cf 100644
--- a/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
@@ -467,12 +467,12 @@ export const CreatePropertyModal: Component<CreatePropertyModalProps> = (
<span class="truncate">{selectedDataTypeLabel()}</span>
<CaretDownIcon class="size-3 text-ink-muted shrink-0" />
</Dropdown.Trigger>
- <Dropdown.Portal>
- <Dropdown.Content class="max-h-64 overflow-y-auto min-w-48">
+ <Dropdown.Content class="max-h-64 overflow-y-auto min-w-48">
+ <Dropdown.Group>
<For each={dataTypeDropdownOptions}>
{(option) => (
<Dropdown.Item
- class="flex items-center justify-between gap-2 px-2 py-1.5 text-sm cursor-pointer"
+ class="justify-between"
onSelect={() => {
setSelectedDataType(option.value);
setNewStringOptions([]);
@@ -480,17 +480,15 @@ export const CreatePropertyModal: Component<CreatePropertyModalProps> = (
setIsMultiSelect(false);
}}
>
- <Dropdown.ItemLabel>
- {option.label}
- </Dropdown.ItemLabel>
+ <span>{option.label}</span>
<Show when={option.value === selectedDataType()}>
<CheckIcon class="size-3 shrink-0" />
</Show>
</Dropdown.Item>
)}
</For>
- </Dropdown.Content>
- </Dropdown.Portal>
+ </Dropdown.Group>
+ </Dropdown.Content>
</Dropdown>
</div>
diff --git a/js/app/packages/property/src/editors/popover/EditorPopover.tsx b/js/app/packages/property/src/editors/popover/EditorPopover.tsx
index 6c65f074d7..248f66643f 100644
--- a/js/app/packages/property/src/editors/popover/EditorPopover.tsx
+++ b/js/app/packages/property/src/editors/popover/EditorPopover.tsx
@@ -1,4 +1,4 @@
-import { cn, Dropdown, Layer } from '@ui';
+import { cn, Dropdown } from '@ui';
import type { JSX } from 'solid-js';
import { useProperty } from '../../core/context';
@@ -15,7 +15,7 @@ type EditorPopoverProps = {
/**
* Floating shell for popover-style editors (date / select / entity). The
* surrounding <Property.Root> hosts a Kobalte DropdownMenu — this component
- * just renders the Portal/Content. Kobalte handles ESC, click-outside, focus
+ * just renders the Content. Kobalte handles ESC, click-outside, focus
* trap, and focus return. `onClose` is invoked on dismissal so consumers can
* save-on-close.
*/
@@ -28,21 +28,17 @@ export function EditorPopover(props: EditorPopoverProps) {
};
return (
- <Dropdown.Portal mount={ctx.portalMount()}>
- {/* manual pointer block for this. */}
- <div class="fixed inset-0 z-action-menu" onClick={close} />
- <Layer depth={3}>
- <Dropdown.Content
- class={cn(
- 'max-h-96 overflow-hidden flex flex-col w-full max-w-60 p-0',
- props.class
- )}
- onEscapeKeyDown={close}
- onInteractOutside={close}
- >
- {props.children}
- </Dropdown.Content>
- </Layer>
- </Dropdown.Portal>
+ <Dropdown.Content
+ mount={ctx.portalMount()}
+ depth={3}
+ class={cn(
+ 'max-h-96 overflow-hidden flex flex-col w-full max-w-60 p-0',
+ props.class
+ )}
+ onEscapeKeyDown={close}
+ onInteractOutside={close}
+ >
+ {props.children}
+ </Dropdown.Content>
);
}