Skip to content

Commit e8519bf

Browse files
owilliams-tetrascienceclaudeCopilot
authored
feat: SW-2118 Evolve Data App Shell into composable AppShell container (#183)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent f31bbd5 commit e8519bf

11 files changed

Lines changed: 1276 additions & 1230 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"use client";
2+
3+
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from "lucide-react";
4+
import * as React from "react";
5+
6+
import { Button } from "@/components/ui/button";
7+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
8+
import { cn } from "@/lib/utils";
9+
10+
const CHEVRONS = {
11+
left: ChevronLeft,
12+
right: ChevronRight,
13+
up: ChevronUp,
14+
down: ChevronDown,
15+
} as const;
16+
17+
export interface ShellCollapseButtonProps extends Omit<React.ComponentProps<typeof Button>, "children"> {
18+
/** Chevron direction the button points at. */
19+
direction: keyof typeof CHEVRONS;
20+
/** Accessible name + tooltip text (e.g. "Collapse navigation"). */
21+
label: string;
22+
/** Tooltip side. Defaults to `right` (rail/sidebar placements). */
23+
tooltipSide?: "top" | "right" | "bottom" | "left";
24+
}
25+
26+
/**
27+
* The shell's shared collapse/expand affordance — a small outlined square with
28+
* a chevron, placed in a zone's header row when expanded and at the top of the
29+
* collapsed rail. One component so every zone's trigger looks identical.
30+
*/
31+
function ShellCollapseButton({
32+
direction,
33+
label,
34+
tooltipSide = "right",
35+
className,
36+
...props
37+
}: ShellCollapseButtonProps) {
38+
const Chevron = CHEVRONS[direction];
39+
// cn() so consumer classes properly override the base (tailwind-merge)
40+
const mergedClassName = cn(
41+
"w-5 h-5 shrink-0 text-muted-foreground hover:text-primary hover:border-primary",
42+
className,
43+
);
44+
return (
45+
<TooltipProvider>
46+
<Tooltip>
47+
<TooltipTrigger asChild>
48+
<Button
49+
data-slot="data-app-shell-collapse-button"
50+
variant="outline"
51+
size="icon"
52+
{...props}
53+
className={mergedClassName}
54+
aria-label={label}
55+
>
56+
<Chevron className="w-3.5 h-3.5" />
57+
</Button>
58+
</TooltipTrigger>
59+
<TooltipContent side={tooltipSide}>{label}</TooltipContent>
60+
</Tooltip>
61+
</TooltipProvider>
62+
);
63+
}
64+
65+
export { ShellCollapseButton };

0 commit comments

Comments
 (0)