-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathStudioTopBar.tsx
More file actions
64 lines (59 loc) · 1.98 KB
/
StudioTopBar.tsx
File metadata and controls
64 lines (59 loc) · 1.98 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
import type { ReactNode } from "react"
import { Link } from "@tanstack/react-router"
import { Home, Settings } from "lucide-react"
import { useLingui } from "@lingui/react/macro"
import { Button } from "@/components/ui/button"
import { LocaleSwitcher } from "@/components/LocaleSwitcher"
import { useSettingsDialog } from "@/routes/__root"
export type StudioTopBarProps = {
/** When true, the brand row links to `/` with hover styles (e.g. add-book flow). */
brandLinksHome?: boolean
/** Optional title after `/` (e.g. translated “Add Book”). */
trailingTitle?: ReactNode
}
export function StudioTopBar({ brandLinksHome = false, trailingTitle }: StudioTopBarProps) {
const { t } = useLingui()
const { openSettings } = useSettingsDialog()
const brandInner = (
<>
<Home className="w-4 h-4 shrink-0" />
<span className="text-sm font-semibold">ADT Studio</span>
</>
)
const brandRow = brandLinksHome ? (
<Link
to="/"
className="flex items-center gap-2.5 hover:bg-gray-600 -ml-2 px-2 h-10 transition-colors"
title={t`Back to books`}
>
{brandInner}
</Link>
) : (
<div className="flex items-center gap-2.5">{brandInner}</div>
)
return (
<div className="shrink-0 min-h-11 py-1 flex items-center bg-gray-700 text-white px-4">
<div className="flex items-center min-w-0">
{brandRow}
{trailingTitle != null && (
<>
<span className="text-white/40 text-sm mx-2">/</span>
<span className="text-sm font-semibold">{trailingTitle}</span>
</>
)}
</div>
<div className="ml-auto flex items-center gap-1.5">
<LocaleSwitcher />
<Button
variant="ghost"
size="icon"
className="h-10 w-10 shrink-0 text-white/70 hover:text-white hover:bg-gray-600"
onClick={openSettings}
title={t`API Key Settings`}
>
<Settings className="h-3.5 w-3.5" />
</Button>
</div>
</div>
)
}