Skip to content

Commit ba4a35d

Browse files
committed
Deconstruct workspace components
1 parent fa7a956 commit ba4a35d

22 files changed

+634
-767
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import { cn } from "@/utils";
2+
import GraphExplorerIcon from "@/components/icons/GraphExplorerIcon";
3+
import type { ComponentPropsWithRef, ReactNode } from "react";
4+
5+
type NavBarProps = {
6+
logoVisible?: boolean;
7+
};
8+
9+
export function NavBar({
10+
className,
11+
children,
12+
logoVisible,
13+
}: ComponentPropsWithRef<"div"> & NavBarProps) {
14+
return (
15+
<div
16+
data-slot="nav-bar"
17+
className={cn(
18+
"bg-background-default text-text-primary flex min-h-14 flex-row items-center gap-3 border-b pr-3",
19+
!logoVisible && "pl-3",
20+
className,
21+
)}
22+
>
23+
{logoVisible ? <NavBarLogo /> : null}
24+
{children}
25+
</div>
26+
);
27+
}
28+
29+
export function NavBarContent({
30+
className,
31+
...props
32+
}: ComponentPropsWithRef<"div">) {
33+
return (
34+
<div
35+
data-slot="nav-bar-content"
36+
className={cn("flex flex-1 flex-row items-center gap-3", className)}
37+
{...props}
38+
/>
39+
);
40+
}
41+
42+
export function NavBarActions({
43+
className,
44+
...props
45+
}: ComponentPropsWithRef<"div">) {
46+
return (
47+
<div
48+
data-slot="nav-bar-actions"
49+
className={cn(
50+
"flex h-full flex-row items-center gap-3 justify-self-end",
51+
className,
52+
)}
53+
{...props}
54+
/>
55+
);
56+
}
57+
58+
function NavBarLogo({ className, ...rest }: ComponentPropsWithRef<"div">) {
59+
return (
60+
<div
61+
data-slot="nav-bar-logo"
62+
className={cn(
63+
"bg-logo-gradient mr-2 grid aspect-square h-full place-content-center overflow-hidden text-white",
64+
className,
65+
)}
66+
{...rest}
67+
>
68+
<GraphExplorerIcon width="2em" height="2em" />
69+
</div>
70+
);
71+
}
72+
73+
export function NavBarVersion({
74+
className,
75+
...props
76+
}: ComponentPropsWithRef<"div">) {
77+
return (
78+
<div
79+
data-slot="nav-bar-version"
80+
className={cn(
81+
"text-text-secondary flex items-center justify-center text-xs font-light",
82+
className,
83+
)}
84+
{...props}
85+
/>
86+
);
87+
}
88+
89+
type NavBarTitleProps = {
90+
title?: ReactNode;
91+
subtitle?: ReactNode;
92+
};
93+
94+
export function NavBarTitle({
95+
title,
96+
subtitle,
97+
className,
98+
children,
99+
...props
100+
}: ComponentPropsWithRef<"div"> & NavBarTitleProps) {
101+
return (
102+
<div className={cn("flex h-full items-center", className)} {...props}>
103+
<div className="flex flex-col">
104+
{title && (
105+
<div className="line-clamp-1 overflow-hidden font-bold">{title}</div>
106+
)}
107+
{subtitle && (
108+
<div className="text-text-secondary line-clamp-1 overflow-hidden text-sm leading-tight font-medium">
109+
{subtitle}
110+
</div>
111+
)}
112+
</div>
113+
{children}
114+
</div>
115+
);
116+
}

packages/graph-explorer/src/components/Panel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function PanelGroup({
1616
<div
1717
data-slot="panel-group"
1818
className={cn(
19-
"bg-background-secondary flex min-h-0 flex-1 gap-2 p-2",
19+
"bg-brand-100 flex min-h-0 min-w-0 flex-1 gap-2 p-2",
2020
className,
2121
)}
2222
{...props}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { cn } from "@/utils";
2+
import type { ComponentPropsWithRef } from "react";
3+
4+
export function Workspace({
5+
className,
6+
...props
7+
}: ComponentPropsWithRef<"div">) {
8+
return (
9+
<div
10+
data-slot="workspace"
11+
className={cn(
12+
"bg-background-secondary flex min-h-0 flex-1 flex-col overflow-hidden",
13+
className,
14+
)}
15+
{...props}
16+
/>
17+
);
18+
}
19+
20+
export function WorkspaceContent({
21+
className,
22+
...props
23+
}: ComponentPropsWithRef<"div">) {
24+
return (
25+
<div
26+
data-slot="workspace-content"
27+
className={cn("flex min-h-0 flex-1 flex-col overflow-hidden", className)}
28+
{...props}
29+
/>
30+
);
31+
}

packages/graph-explorer/src/components/Workspace/Workspace.tsx

Lines changed: 0 additions & 59 deletions
This file was deleted.

packages/graph-explorer/src/components/Workspace/components/NavBarLogo.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/graph-explorer/src/components/Workspace/components/SidebarButton.tsx

Lines changed: 0 additions & 65 deletions
This file was deleted.

packages/graph-explorer/src/components/Workspace/components/WorkspaceSideBar.tsx

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)