Skip to content

Commit 1fde486

Browse files
committed
Align Command K with Platform menu spacing
1 parent f4643da commit 1fde486

9 files changed

Lines changed: 43 additions & 44 deletions

File tree

‎apps/sim/platform/app/(shell)/_components/command-menu/command-menu.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export function CommandMenu({ open, onClose, navigate, chats, workspaces }: Comm
3232
items: chats.map((item) => ({
3333
id: item.id,
3434
label: item.title,
35-
icon: 'I073',
3635
value: `/chat/${item.id}`,
3736
})),
3837
},

‎apps/sim/platform/checks/shell.spec.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ test('a keyboard search navigates to the matching chat and shell edits survive t
101101
const search = page.getByRole('combobox', { name: 'Search the platform' })
102102
await expect(search).toBeFocused()
103103
const list = page.getByRole('listbox', { name: 'Search results' })
104+
const settings = list.getByRole('option', { name: 'Settings', exact: true })
105+
const resting = await settings.evaluate((option) => getComputedStyle(option).backgroundColor)
106+
const icon = settings.locator('svg')
107+
const restingInk = await icon.evaluate((glyph) => getComputedStyle(glyph).color)
108+
await settings.hover()
109+
await expect(settings).not.toHaveCSS('background-color', resting)
110+
await expect(icon).not.toHaveCSS('color', restingInk)
111+
await search.press('ArrowDown')
112+
await expect(settings).toHaveCSS('background-color', resting)
113+
await expect(icon).toHaveCSS('color', restingInk)
114+
await expect(list.getByRole('option', { name: 'Integrations', exact: true })).not.toHaveCSS(
115+
'background-color',
116+
resting
117+
)
104118
await expect(list).not.toHaveCSS('mask-image', 'none')
105119
const initialFade = await list.evaluate((element) => getComputedStyle(element).maskImage)
106120
await list.evaluate((element) => {

‎apps/sim/platform/design-system/components/command-palette/command-palette.module.css‎

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
.field,
2-
.result,
32
.footer,
43
.footer > span {
54
display: flex;
65
align-items: center;
76
}
87
.field {
98
flex: none;
10-
gap: var(--spacing-12);
9+
gap: var(--ui-row-gap);
1110
min-block-size: var(--spacing-44);
12-
padding-inline: var(--spacing-20);
11+
padding-inline: var(--ui-dialog-inset);
1312
}
1413
.field input {
1514
flex: 1;
@@ -31,39 +30,22 @@
3130
gap: var(--ui-list-gap);
3231
}
3332
.group + .group {
34-
padding-block-start: var(--ui-popup-padding);
35-
}
36-
.heading {
37-
display: flex;
38-
align-items: flex-end;
39-
min-block-size: var(--spacing-32);
40-
padding: var(--ui-popup-padding) var(--spacing-12);
41-
color: var(--ui-secondary);
42-
}
43-
.result {
44-
min-block-size: var(--spacing-36);
45-
padding: var(--ui-row-block) var(--spacing-12);
46-
gap: var(--spacing-12);
47-
border-radius: var(--ui-control-radius);
48-
cursor: pointer;
49-
overflow-wrap: anywhere;
50-
}
51-
.result[data-highlighted] {
52-
background: var(--ui-hover);
33+
padding-block-start: var(--ui-section-gap);
5334
}
5435
.empty:not(:empty) {
55-
padding: var(--spacing-12) var(--spacing-20);
36+
padding: var(--ui-section-gap) var(--ui-dialog-inset);
5637
color: var(--ui-secondary);
5738
}
5839
.footer {
5940
flex: none;
41+
flex-wrap: wrap;
6042
min-block-size: var(--spacing-40);
61-
padding: var(--ui-row-block) var(--spacing-16);
43+
padding: var(--ui-row-block) var(--ui-dialog-inset);
6244
color: var(--ui-secondary);
63-
gap: var(--spacing-16);
45+
gap: var(--ui-list-gap) var(--ui-section-gap);
6446
}
6547
.footer > span {
66-
gap: var(--ui-popup-padding);
48+
gap: var(--spacing-4);
6749
}
6850
.footer > span:last-child {
6951
margin-inline-start: auto;

‎apps/sim/platform/design-system/components/command-palette/command-palette.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Autocomplete } from '@base-ui/react/autocomplete'
44
import type { IconName } from '@/platform/design-system/catalog/icon-geometry'
55
import styles from '@/platform/design-system/components/command-palette/command-palette.module.css'
66
import { Icon } from '@/platform/design-system/components/icon/icon'
7+
import popup from '@/platform/design-system/components/menu/popup.shared.module.css'
78
import { useScrollEdges } from '@/platform/design-system/components/scroll-area/use-scroll-edges'
89

910
interface Command {
@@ -46,7 +47,7 @@ export function CommandPalette({ groups, label, onSelect }: CommandPaletteProps)
4647
{(group: CommandGroup) => (
4748
<Autocomplete.Group key={group.label ?? ''} items={group.items} className={styles.group}>
4849
{group.label && (
49-
<Autocomplete.GroupLabel className={styles.heading} data-type='T052'>
50+
<Autocomplete.GroupLabel className={popup.heading} data-type='T052'>
5051
{group.label}
5152
</Autocomplete.GroupLabel>
5253
)}
@@ -55,12 +56,12 @@ export function CommandPalette({ groups, label, onSelect }: CommandPaletteProps)
5556
<Autocomplete.Item
5657
key={item.id}
5758
value={item}
58-
className={styles.result}
59-
data-type='T043'
59+
className={popup.item}
60+
data-type='T060'
6061
onClick={() => onSelect(item.value)}
6162
>
6263
{item.icon && <Icon name={item.icon} />}
63-
<span>{item.label}</span>
64+
<span className={popup.label}>{item.label}</span>
6465
</Autocomplete.Item>
6566
)}
6667
</Autocomplete.Collection>

‎apps/sim/platform/design-system/components/menu/action-menu.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function TriggeredMenu({
152152
)}
153153
<ActionMenuPopup label={label} container={container} align={align}>
154154
{heading && (
155-
<div className={styles.menuTitle} data-type='T052'>
155+
<div className={popup.heading} data-type='T052'>
156156
{heading}
157157
</div>
158158
)}
@@ -557,7 +557,7 @@ export function VisibilityMenu({ label, options, onChange }: VisibilityMenuProps
557557
const [choices, setChoices] = useState<Readonly<Record<string, boolean>>>({})
558558
return (
559559
<MenuSurface label={label} layout='visibility'>
560-
<div className={styles.menuTitle} data-type='T052'>
560+
<div className={popup.heading} data-type='T052'>
561561
{label}
562562
</div>
563563
{options.map((option) => {

‎apps/sim/platform/design-system/components/menu/menu.module.css‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@
4040
.separator {
4141
composes: separator from "./popup.shared.module.css";
4242
}
43-
.menuTitle {
44-
display: flex;
45-
align-items: center;
46-
padding-inline: var(--spacing-8);
47-
min-block-size: var(--spacing-28);
48-
color: var(--ui-secondary);
49-
}
50-
5143
.menu[data-menu="zoom"] {
5244
inline-size: var(--menu-zoom-width);
5345
}

‎apps/sim/platform/design-system/components/menu/popup.shared.module.css‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
overscroll-behavior: contain;
2828
}
2929

30+
.heading {
31+
display: flex;
32+
align-items: center;
33+
min-block-size: var(--spacing-28);
34+
padding-inline: var(--ui-row-inset);
35+
color: var(--ui-secondary);
36+
}
37+
3038
.item {
3139
display: flex;
3240
align-items: center;
@@ -40,7 +48,10 @@
4048
text-align: start;
4149
}
4250

43-
.item:not(:disabled, [data-disabled], [aria-disabled="true"]):is(:hover, [data-highlighted]) {
51+
.item:not(:disabled, [data-disabled], [aria-disabled="true"]):is(
52+
[data-highlighted],
53+
:hover:not([role="option"])
54+
) {
4455
background: var(--ui-hover);
4556
}
4657

‎apps/sim/platform/design-system/styles/rhythm.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
[role="menuitemcheckbox"],
4545
[role="option"]
4646
):not(:disabled, [data-disabled], [aria-disabled="true"]):is(
47-
:hover,
47+
:hover:not([role="option"]),
4848
[data-highlighted],
4949
[data-popup-open]
5050
),

‎apps/sim/platform/docs/core-chat-states.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Hide Email or Calendar from the widget menu or Customize Home. Email and calenda
1414

1515
## Current navigation
1616

17-
The shared product layout keeps the main sidebar at the same scroll position when a chat opens or a reader returns from Settings. Closing and reopening the compact drawer also preserves the position. Command K lists Home, Settings and Integrations, followed by workspace and chat results in sidebar order. Integrations and workspace selections currently go to Home.
17+
The shared product layout keeps the main sidebar at the same scroll position when a chat opens or a reader returns from Settings. Closing and reopening the compact drawer also preserves the position. Command K lists Home, Settings and Integrations with their destination icons, followed by text-only workspace and chat results in sidebar order. It uses the same rows and section headings as Platform menus; the search, results and keyboard hints share the dialog’s content inset. Integrations and workspace selections currently go to Home.
1818

1919
## Settings coverage
2020

0 commit comments

Comments
 (0)