authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-22 12:22:13-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-22 12:22:13-07:00
logbe80e369394f5d0cb771b51669686f2bc916e543
tree3ac15b3d1e1c4e654abb7b9cd6770b01f3cb6edf
parent7b54af90f79a6858f75ff86d42a2f083d4edfa2a
signature Signed by PGP key B5690EEEBB952194

refactor(web): add SidebarInput (#13028)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

4 files changed, 23 insertions(+), 10 deletions(-)

apps/web/src/components/settings/SettingsSidebarNav.tsx+3-4
......@@ -27,7 +27,6 @@ import {
2727import { useLocation, useNavigate } from "@tanstack/react-router";
2828
2929import { Button } from "../ui/button";
30import { Input } from "../ui/input";
3130import { Kbd } from "../ui/kbd";
3231import {
3332 SidebarContent,
......@@ -37,6 +36,7 @@ import {
3736 SidebarMenuButton,
3837 SidebarMenuItem,
3938 useSidebar,
39 SidebarInput,
4040} from "../ui/sidebar";
4141import { SidebarUtilityMenu } from "../sidebar/SidebarChrome";
4242import { scrollToSettingsTarget } from "./settingsLayout";
......@@ -237,10 +237,9 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
237237 <SidebarGroup className="gap-2 p-[var(--sidebar-content-inset)]">
238238 <div className="flex h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground">
239239 <SearchIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
240 <Input
240 <SidebarInput
241241 ref={searchInputRef}
242242 nativeInput
243 unstyled
244243 type="search"
245244 value={query}
246245 onChange={(event) => {
......@@ -259,7 +258,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
259258 ? `settings-search-result-${results[activeResultIndex].id}`
260259 : undefined
261260 }
262 className="min-w-0 flex-1 [&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:placeholder:text-sidebar-muted-foreground"
261 className="min-w-0 flex-1"
263262 />
264263 {isSearching ? (
265264 <Button
apps/web/src/components/sidebar/SidebarThreadHeader.tsx+3-5
......@@ -21,8 +21,7 @@ import {
2121
2222import { cn } from "~/lib/utils";
2323import { Button } from "../ui/button";
24import { Input } from "../ui/input";
25import { SidebarMenuButton } from "../ui/sidebar";
24import { SidebarInput, SidebarMenuButton } from "../ui/sidebar";
2625import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
2726
2827export interface SidebarThreadHeaderProps {
......@@ -85,10 +84,9 @@ export function SidebarThreadHeader({
8584 className="flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
8685 >
8786 <SearchIcon className="size-4 shrink-0 text-[var(--sidebar-icon-color)]" />
88 <Input
87 <SidebarInput
8988 ref={searchInputRef}
9089 nativeInput
91 unstyled
9290 type="search"
9391 value={searchQuery}
9492 onChange={(event) => onSearchQueryChange(event.currentTarget.value)}
......@@ -104,7 +102,7 @@ export function SidebarThreadHeader({
104102 ? `sidebar-thread-search-result-${activeSearchResultIndex}`
105103 : undefined
106104 }
107 className="min-w-0 flex-1 [&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:placeholder:text-[var(--sidebar-icon-color)]"
105 className="min-w-0 flex-1"
108106 />
109107 {isSearching ? (
110108 <Button
apps/web/src/components/ui/sidebar.tsx+16
......@@ -5,6 +5,7 @@ import { PanelLeftCloseIcon, PanelLeftIcon } from "lucide-react";
55import * as React from "react";
66import { cn } from "~/lib/utils";
77import { Button } from "~/components/ui/button";
8import { Input, type InputProps } from "~/components/ui/input";
89import { ScrollArea } from "~/components/ui/scroll-area";
910import {
1011 Sheet,
......@@ -530,6 +531,20 @@ function SidebarRail({
530531 );
531532}
532533
534/** A bare search or rename field that sits in a row of sidebar chrome. */
535function SidebarInput({ className, ...props }: Omit<InputProps, "unstyled" | "variant">) {
536 return (
537 <Input
538 className={cn(
539 "[&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:placeholder:text-sidebar-muted-foreground",
540 className,
541 )}
542 unstyled
543 {...props}
544 />
545 );
546}
547
533548function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
534549 return (
535550 <main
......@@ -770,6 +785,7 @@ function SidebarMenuSubButton({
770785}
771786
772787export {
788 SidebarInput,
773789 Sidebar,
774790 SidebarContent,
775791 SidebarFooter,
scripts/lint-restyle-ceiling.ts+1-1
......@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
88// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
99// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
1010// migrate a file, and delete this script when the rule becomes an error.
11export const RESTYLE_CEILING = 1043;
11export const RESTYLE_CEILING = 1031;
1212
1313const RULE = "shadcn(no-restyle)";
1414