Skip to content

Commit 950e71c

Browse files
refactor(web): one minimum width for menus, three widths for popovers
MenuPopup decided whether to apply its minimum width by scanning the incoming className for w-/min-w- tokens, and 37 menus picked widths from fourteen values. Menus size to their content; they now share one minimum (10rem) and a viewport cap, and no width prop. Popovers hold prose and forms, so a fixed width is real: width="sm|md|lg" (16, 20, 24rem). Select lists match their trigger, as SelectPopup already does. Visible effect: menus that had forced a width of 14-24rem now fit their content from a 10rem floor; popovers snap to the nearest of three widths (e.g. 18rem becomes 20rem, 28rem becomes 24rem); the keybinding selects match their trigger instead of a fixed floor. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent b6fbe37 commit 950e71c

43 files changed

Lines changed: 69 additions & 98 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/web/src/browser/BrowserDeviceToolbar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export function BrowserDeviceToolbar({
197197
>
198198
<SelectValue />
199199
</SelectTrigger>
200-
<SelectPopup align="start" alignItemWithTrigger={false} className="min-w-64">
200+
<SelectPopup align="start" alignItemWithTrigger={false}>
201201
<SelectItem value={RESPONSIVE_VALUE}>Responsive</SelectItem>
202202
<SelectGroup>
203203
<SelectGroupLabel>Standard</SelectGroupLabel>

‎apps/web/src/components/BranchToolbar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
217217
{triggerContent}
218218
<ChevronDownIcon className="size-3 shrink-0 opacity-50" />
219219
</MenuTrigger>
220-
<MenuPopup align="start" side="top" className="w-64" {...composerFloatingLayerProps}>
220+
<MenuPopup align="start" side="top" {...composerFloatingLayerProps}>
221221
{showEnvironmentPicker && availableEnvironments && onEnvironmentChange ? (
222222
<>
223223
<MenuGroup>

‎apps/web/src/components/DiffPanel.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ export default function DiffPanel({
678678
<span className="truncate">{selectedScopeLabel}</span>
679679
<ChevronDownIcon className="size-3.5 shrink-0 opacity-70" />
680680
</DropdownMenuTrigger>
681-
<DropdownMenuContent align="start" className="w-60">
681+
<DropdownMenuContent align="start">
682682
<DropdownMenuRadioGroup value={selectedScopeValue} onValueChange={selectScopeValue}>
683683
<DropdownMenuRadioItem value="unstaged" closeOnClick>
684684
<span>Working tree</span>
@@ -692,7 +692,7 @@ export default function DiffPanel({
692692
</DropdownMenuRadioGroup>
693693
<DropdownMenuSub>
694694
<DropdownMenuSubTrigger>Turn</DropdownMenuSubTrigger>
695-
<DropdownMenuSubContent className="w-64">
695+
<DropdownMenuSubContent>
696696
<DropdownMenuRadioGroup value={selectedTurnValue} onValueChange={selectScopeValue}>
697697
{orderedTurnDiffSummaries.map((summary) => {
698698
const turnCount =

‎apps/web/src/components/GitActionsControl.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ export default function GitActionsControl({
17931793
<SourceControlIcon className="size-4" />
17941794
<MenuItemLabel>Git actions</MenuItemLabel>
17951795
</MenuSubTrigger>
1796-
<MenuSubPopup className="min-w-32 max-w-[calc(100vw-2rem)]">{gitItems}</MenuSubPopup>
1796+
<MenuSubPopup>{gitItems}</MenuSubPopup>
17971797
</MenuSub>
17981798
</>
17991799
)
@@ -1859,9 +1859,7 @@ export default function GitActionsControl({
18591859
>
18601860
<ChevronDownIcon aria-hidden="true" className="size-4" />
18611861
</MenuTrigger>
1862-
<MenuPopup align="end" className="w-full">
1863-
{gitItems}
1864-
</MenuPopup>
1862+
<MenuPopup align="end">{gitItems}</MenuPopup>
18651863
</Menu>
18661864
</Group>
18671865
)}

‎apps/web/src/components/LegacySidebar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2747,7 +2747,7 @@ function ProjectSortMenu({
27472747
</TooltipTrigger>
27482748
<TooltipPopup side="right">Sidebar options</TooltipPopup>
27492749
</Tooltip>
2750-
<MenuPopup align="end" side="bottom" className="min-w-52">
2750+
<MenuPopup align="end" side="bottom">
27512751
<MenuGroup>
27522752
<div className="px-2 py-1 sm:text-xs font-medium text-muted-foreground">
27532753
Sort projects

‎apps/web/src/components/ProjectScriptsControl.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@ export default function ProjectScriptsControl({
258258
<ScriptIcon icon="play" className="size-4" />
259259
<MenuItemLabel>Project actions</MenuItemLabel>
260260
</MenuSubTrigger>
261-
<MenuSubPopup className="min-w-32 max-w-[calc(100vw-2rem)]">
262-
{scriptItems}
263-
</MenuSubPopup>
261+
<MenuSubPopup>{scriptItems}</MenuSubPopup>
264262
</MenuSub>
265263
) : (
266264
<MenuItem

‎apps/web/src/components/RightPanelTabs.tsx‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,7 @@ function RightPanelEmptyState(props: {
567567
>
568568
<ChevronDown className="size-3.5" />
569569
</MenuTrigger>
570-
<MenuPopup
571-
align="end"
572-
side="bottom"
573-
sideOffset={6}
574-
className="min-w-40 max-w-56"
575-
>
570+
<MenuPopup align="end" side="bottom" sideOffset={6}>
576571
{props.browserProfiles.map((profile) => (
577572
<MenuItem
578573
key={profile.id}
@@ -1273,7 +1268,6 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
12731268
align="start"
12741269
side="bottom"
12751270
sideOffset={6}
1276-
className="min-w-44"
12771271
onKeyDownCapture={handleAddSurfaceMenuKeyDown}
12781272
>
12791273
{addSurfaceActions.map((action) => {
@@ -1314,7 +1308,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
13141308
and run to 48 characters, which would otherwise widen
13151309
the popup to fit-content and wrap.
13161310
*/}
1317-
<MenuSubPopup className="min-w-40 max-w-56">
1311+
<MenuSubPopup>
13181312
{browserProfiles.map((profile) => (
13191313
<MenuItem
13201314
key={profile.id}

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ function SnoozePopoverButton(props: {
475475
</TooltipTrigger>
476476
<TooltipPopup>Snooze thread</TooltipPopup>
477477
</Tooltip>
478-
<PopoverPopup side="bottom" align="end" className="w-56" viewportClassName="p-1">
478+
<PopoverPopup side="bottom" align="end" width="sm" viewportClassName="p-1">
479479
{presets.map((preset) => (
480480
<button
481481
key={preset.id}

‎apps/web/src/components/chat/AssistantCitationChip.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function AssistantCitationChip({
186186
return false;
187187
}}
188188
aria-label="Edit citation comment"
189-
className="w-72 max-w-[calc(100vw-1rem)]"
189+
width="md"
190190
viewportClassName="p-3"
191191
onPointerDown={(event) => event.stopPropagation()}
192192
>

‎apps/web/src/components/chat/ChatHeader.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ export const ChatHeader = memo(function ChatHeader({
516516
keepMounted
517517
aria-label="Header actions"
518518
align="end"
519-
className="min-w-56 max-w-[calc(100vw-2rem)]"
520519
finalFocus={actionsCollapsed ? undefined : false}
521520
>
522521
<div ref={mountMenuActions} className="contents" />

0 commit comments

Comments
 (0)