2024-01-30 14:19:25 +00:00
|
|
|
'use client'
|
|
|
|
|
2024-01-15 12:33:15 +00:00
|
|
|
import Link from 'next/link'
|
|
|
|
import { Icon } from './Icon'
|
|
|
|
import { Search } from './Search'
|
|
|
|
import { ThemeSwitcher } from './ThemeSwitcher'
|
|
|
|
|
2024-02-05 14:32:50 +00:00
|
|
|
export function Header({ sectionId }: { sectionId?: string }) {
|
2024-01-15 12:33:15 +00:00
|
|
|
return (
|
|
|
|
<div className="layout__header">
|
2024-02-13 10:07:29 +00:00
|
|
|
<div className="layout__header__left">
|
|
|
|
<Link href="/quick-start">
|
|
|
|
<div
|
|
|
|
className="lockup"
|
|
|
|
style={{
|
|
|
|
mask: `url(/lockup.svg) center 100% / 100% no-repeat`,
|
|
|
|
WebkitMask: `url(/lockup.svg) center 100% / 100% no-repeat`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Link>
|
|
|
|
</div>
|
2024-02-05 14:32:50 +00:00
|
|
|
<Search />
|
2024-01-30 14:19:25 +00:00
|
|
|
<div className="layout__header__sections_and_socials">
|
|
|
|
<SectionLinks sectionId={sectionId} />
|
2024-02-05 14:42:55 +00:00
|
|
|
<a
|
|
|
|
href="https://x.com/tldraw/"
|
|
|
|
className="sidebar__button icon-button"
|
|
|
|
title="twitter"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
<Icon icon="twitter" />
|
|
|
|
</a>
|
2024-01-15 12:33:15 +00:00
|
|
|
<a
|
2024-01-30 14:19:25 +00:00
|
|
|
href="https://discord.com/invite/SBBEVCA4PG"
|
2024-01-15 12:33:15 +00:00
|
|
|
className="sidebar__button icon-button"
|
2024-01-30 14:19:25 +00:00
|
|
|
title="discord"
|
2024-02-05 14:42:55 +00:00
|
|
|
target="_blank"
|
2024-01-15 12:33:15 +00:00
|
|
|
>
|
2024-01-30 14:19:25 +00:00
|
|
|
<Icon icon="discord" />
|
2024-01-15 12:33:15 +00:00
|
|
|
</a>
|
|
|
|
<a
|
|
|
|
href="https://github.com/tldraw/tldraw"
|
|
|
|
className="sidebar__button icon-button"
|
|
|
|
title="github"
|
2024-02-05 14:42:55 +00:00
|
|
|
target="_blank"
|
2024-01-15 12:33:15 +00:00
|
|
|
>
|
|
|
|
<Icon icon="github" />
|
|
|
|
</a>
|
2024-02-05 14:42:55 +00:00
|
|
|
<ThemeSwitcher />
|
2024-01-15 12:33:15 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
2024-01-30 14:19:25 +00:00
|
|
|
|
|
|
|
export function SectionLinks({ sectionId }: { sectionId?: string | null }) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<a
|
|
|
|
href="/quick-start"
|
|
|
|
title="Learn"
|
|
|
|
data-active={!['reference', 'examples'].includes(sectionId || '')}
|
|
|
|
className="layout_header__section"
|
|
|
|
>
|
|
|
|
Learn
|
|
|
|
</a>
|
|
|
|
<a
|
|
|
|
href="/reference/editor/Editor"
|
|
|
|
title="Reference"
|
|
|
|
data-active={sectionId === 'reference'}
|
|
|
|
className="layout_header__section"
|
|
|
|
>
|
|
|
|
Reference
|
|
|
|
</a>
|
|
|
|
<a
|
2024-02-05 14:42:55 +00:00
|
|
|
href="/examples/basic/basic"
|
2024-01-30 14:19:25 +00:00
|
|
|
title="Examples"
|
|
|
|
data-active={sectionId === 'examples'}
|
|
|
|
className="layout_header__section"
|
|
|
|
>
|
|
|
|
Examples
|
|
|
|
</a>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|