Skip to content

Commit 08c2ab7

Browse files
committed
fix(webapp): match Help & Feedback popover Shortcuts and Contact us items to the other entries
The "Shortcuts" and "Contact us…" entries used Button variant="small-menu-item" (bright, smaller text, misaligned icon) while the other entries use SideMenuItem. Add a shared SideMenuItemButton that mirrors SideMenuItem's styling and works as a Radix asChild dialog/sheet trigger, and use it for both entries.
1 parent ea62538 commit 08c2ab7

4 files changed

Lines changed: 46 additions & 27 deletions

File tree

.server-changes/side-menu-project-and-org-menus.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Refresh the side menu and account UI:
2727
- Align the organization settings and account side menus' horizontal padding
2828
with the main side menu, and tighten the "Personal Access Tokens" label so it
2929
no longer truncates.
30+
- Restyle the "Shortcuts" and "Contact us…" entries in the Help & Feedback
31+
popover to match the other menu items (icon size/alignment, dimmed text, text
32+
size).
3033

3134
The org loader now exposes whether the RBAC and SSO plugins are installed so the
3235
side menu can gate the Roles and SSO items the same way the settings side menu

apps/webapp/app/components/Shortcuts.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { KeyboardIcon } from "~/assets/icons/KeyboardIcon";
22
import { useState } from "react";
33
import { useShortcutKeys } from "~/hooks/useShortcutKeys";
4-
import { Button } from "./primitives/Buttons";
54
import { Header3 } from "./primitives/Headers";
5+
import { SideMenuItemButton } from "./navigation/SideMenuItem";
66
import { Paragraph } from "./primitives/Paragraph";
77
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "./primitives/SheetV3";
88
import { ShortcutKey } from "./primitives/ShortcutKey";
@@ -11,19 +11,7 @@ export function Shortcuts() {
1111
return (
1212
<Sheet>
1313
<SheetTrigger asChild>
14-
<Button
15-
variant="small-menu-item"
16-
LeadingIcon={KeyboardIcon}
17-
leadingIconClassName="text-text-dimmed group-hover/button:text-text-bright"
18-
data-action="shortcuts"
19-
fullWidth
20-
textAlignLeft
21-
shortcut={{ modifiers: ["shift"], key: "?", enabled: false }}
22-
className="gap-x-0 pl-1.5"
23-
iconSpacing="gap-x-1.5"
24-
>
25-
Shortcuts
26-
</Button>
14+
<SideMenuItemButton icon={KeyboardIcon} name="Shortcuts" data-action="shortcuts" />
2715
</SheetTrigger>
2816
<ShortcutContent />
2917
</Sheet>

apps/webapp/app/components/navigation/HelpAndFeedbackPopover.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import { useRecentChangelogs } from "~/routes/resources.platform-changelogs";
1313
import { cn } from "~/utils/cn";
1414
import { Feedback } from "../Feedback";
1515
import { Shortcuts } from "../Shortcuts";
16-
import { Button } from "../primitives/Buttons";
1716
import { Paragraph } from "../primitives/Paragraph";
1817
import { Popover, PopoverContent, PopoverTrigger } from "../primitives/Popover";
1918
import { ShortcutKey } from "../primitives/ShortcutKey";
2019
import { SimpleTooltip } from "../primitives/Tooltip";
21-
import { SideMenuItem } from "./SideMenuItem";
20+
import { SideMenuItem, SideMenuItemButton } from "./SideMenuItem";
2221

2322
export function HelpAndFeedback({
2423
disableShortcut = false,
@@ -125,17 +124,11 @@ export function HelpAndFeedback({
125124
<Shortcuts />
126125
<Feedback
127126
button={
128-
<Button
129-
variant="small-menu-item"
130-
className="pl-2"
131-
LeadingIcon={EnvelopeIcon}
132-
leadingIconClassName="pr-1 text-text-dimmed group-hover/button:text-text-bright"
127+
<SideMenuItemButton
128+
icon={EnvelopeIcon}
129+
name="Contact us…"
133130
data-action="contact-us"
134-
fullWidth
135-
textAlignLeft
136-
>
137-
Contact us…
138-
</Button>
131+
/>
139132
}
140133
/>
141134
</div>

apps/webapp/app/components/navigation/SideMenuItem.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { type AnchorHTMLAttributes, type ReactNode } from "react";
1+
import {
2+
type AnchorHTMLAttributes,
3+
type ButtonHTMLAttributes,
4+
forwardRef,
5+
type ReactNode,
6+
} from "react";
27
import { Link } from "@remix-run/react";
38
import { motion } from "framer-motion";
49
import { usePathName } from "~/hooks/usePathName";
@@ -161,3 +166,33 @@ export function SideMenuItem({
161166
/>
162167
);
163168
}
169+
170+
/**
171+
* A button styled to match {@link SideMenuItem}, for menu entries that open a
172+
* dialog/sheet rather than navigate. Forwards its ref and props so it can be
173+
* used as a Radix `asChild` trigger.
174+
*/
175+
export const SideMenuItemButton = forwardRef<
176+
HTMLButtonElement,
177+
{ icon: RenderIcon; name: string } & ButtonHTMLAttributes<HTMLButtonElement>
178+
>(function SideMenuItemButton({ icon, name, className, type, ...props }, ref) {
179+
return (
180+
<button
181+
ref={ref}
182+
type={type ?? "button"}
183+
className={cn(
184+
"group/menuitem flex h-8 w-full items-center gap-2 overflow-hidden rounded pl-[0.4375rem] pr-2 text-left text-text-dimmed hover:bg-charcoal-750 hover:text-text-bright focus-custom",
185+
className
186+
)}
187+
{...props}
188+
>
189+
<Icon
190+
icon={icon}
191+
className="size-5 shrink-0 text-text-dimmed group-hover/menuitem:text-text-bright"
192+
/>
193+
<span className="min-w-0 select-none truncate text-[0.90625rem] font-medium tracking-[-0.01em]">
194+
{name}
195+
</span>
196+
</button>
197+
);
198+
});

0 commit comments

Comments
 (0)