Skip to content

Commit 2d8ca4d

Browse files
adamleithpclaude
andcommitted
fix(channels): pin project switcher menu width in button variant
The button-variant trigger spans the full sidebar width, so binding the dropdown to --anchor-width stretched the menu and broke its layout. Pin a fixed width for the button variant; the item variant still matches its anchor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7457051 commit 2d8ca4d

4 files changed

Lines changed: 30 additions & 15 deletions

File tree

packages/ui/src/features/canvas/components/ChannelsList.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
DropdownMenuSeparator,
3434
DropdownMenuTrigger,
3535
MenuLabel,
36+
Separator,
3637
} from "@posthog/quill";
3738
import type { Task } from "@posthog/shared/domain-types";
3839
import { CreateChannelModal } from "@posthog/ui/features/canvas/components/CreateChannelModal";
@@ -526,19 +527,22 @@ export function ChannelsList() {
526527
return (
527528
<>
528529
<Flex direction="column" gap="px" className="px-2 pb-2">
529-
<Box className="px-2 py-1.5">
530-
<MenuLabel className="uppercase">Channels</MenuLabel>
530+
<Box className="py-1.5">
531+
<Separator />
532+
</Box>
533+
<Box>
534+
<MenuLabel className="group flex items-center justify-between uppercase">
535+
Channels
536+
<Button
537+
variant="outline"
538+
size="icon-xs"
539+
onClick={() => setModalOpen(true)}
540+
className="group-hover:border-border"
541+
>
542+
<PlusIcon size={14} />
543+
</Button>
544+
</MenuLabel>
531545
</Box>
532-
533-
<Button
534-
variant="outline"
535-
size="default"
536-
className="mb-1 w-full justify-start gap-2"
537-
onClick={() => setModalOpen(true)}
538-
>
539-
<PlusIcon size={14} />
540-
New
541-
</Button>
542546

543547
{!isLoading && channels.length === 0 && (
544548
<Text size="1" className="px-2 text-gray-9">

packages/ui/src/features/sidebar/components/ProjectSwitcher.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,14 @@ export function ProjectSwitcher({
207207
<DropdownMenuContent
208208
align="start"
209209
side="bottom"
210-
className="w-(--anchor-width) max-w-(--anchor-width) pt-0"
210+
className={
211+
// The `button` trigger spans the full sidebar width, so binding the
212+
// menu to `--anchor-width` would stretch it and break the layout. Pin
213+
// a fixed width there; the `item` trigger matches its anchor.
214+
triggerVariant === "button"
215+
? "w-64 min-w-64 pt-0"
216+
: "w-(--anchor-width) max-w-(--anchor-width) pt-0"
217+
}
211218
sideOffset={4}
212219
>
213220
<Box>

packages/ui/src/router/routes/__root.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ function RootLayout() {
217217
<ChannelsSidebar />
218218
{/* Content sits in a bordered, rounded card inset from the window
219219
edges — the framed pane from the design. */}
220-
<Box flexGrow="1" className="overflow-hidden px-2 pb-2">
221-
<Box className="h-full overflow-hidden rounded-lg border border-gray-6 bg-gray-1">
220+
<Box flexGrow="1" className="overflow-hidden pr-2 pb-2">
221+
<Box className="h-full overflow-hidden rounded-sm border border-gray-6 bg-gray-1">
222222
<Outlet />
223223
</Box>
224224
</Box>

packages/ui/src/styles/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,10 @@ button,
10491049
cursor: pointer;
10501050
}
10511051

1052+
.quill-button.quill-button--variant-outline:hover {
1053+
background-color: var(--color-fill-hover);
1054+
}
1055+
10521056
/* PostHog Lemon UI button style — applies to solid buttons in explicitly-light Theme wrappers
10531057
(auth screen, onboarding flow). Uses the 3D depth shadow and lift-on-hover effect. */
10541058
.radix-themes[data-appearance="light"] .rt-Button[data-variant="solid"] {

0 commit comments

Comments
 (0)