-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy patheditor-sidebar-content.tsx
More file actions
71 lines (61 loc) · 2.32 KB
/
Copy patheditor-sidebar-content.tsx
File metadata and controls
71 lines (61 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"use client";
import { useTranslations } from "next-intl";
import { parseAsString, useQueryState } from "nuqs";
import { ScrollArea } from "../ui/scroll-area";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs";
import { EditorDocumentPanel } from "./editor-document-panel";
import { EditorImportLeftovers } from "./editor-import-leftovers";
import { EditorLayoutTemplateList } from "./editor-layout/ed-layout-template-list";
import { EditorSectionList } from "./editor-sections/ed-section-list";
import { EditorSectionOrderReset } from "./editor-sections/ed-section-order-reset";
const TABS = [
{ value: "editor", labelKey: "tabEditor" },
{ value: "layout", labelKey: "tabLayout" },
{ value: "document", labelKey: "tabDocument", id: "tour-document-tab" },
];
const PANEL_HEIGHT = "h-[calc(100vh-7rem)] xl:h-[calc(100vh-7rem)]";
export function EditorSidebarContent() {
const t = useTranslations("editor.chrome");
const [tab, setTab] = useQueryState(
"editor-tab",
parseAsString.withDefault(TABS[0].value),
);
const onTabChange = (next: string) => setTab(next);
return (
<div className="flex flex-col py-6">
<EditorImportLeftovers />
<Tabs value={tab} onValueChange={onTabChange}>
<div className="flex shrink-0 items-center gap-2 px-4">
<TabsList>
{TABS.map((item) => (
<TabsTrigger key={item.value} value={item.value} id={item.id}>
{t(item.labelKey)}
</TabsTrigger>
))}
</TabsList>
</div>
<TabsContent value="editor">
<ScrollArea id="tour-editor-sections" className={PANEL_HEIGHT}>
<div className="flex items-center justify-end px-4 pt-4">
<h3 className="text-sm font-medium sr-only">
{t("sectionsHeading")}
</h3>
<EditorSectionOrderReset />
</div>
<EditorSectionList />
</ScrollArea>
</TabsContent>
<TabsContent value="layout">
<ScrollArea className={PANEL_HEIGHT}>
<EditorLayoutTemplateList />
</ScrollArea>
</TabsContent>
<TabsContent value="document">
<ScrollArea className={PANEL_HEIGHT}>
<EditorDocumentPanel />
</ScrollArea>
</TabsContent>
</Tabs>
</div>
);
}