tldraw/apps/docs/components/Header.tsx
Steve Ruiz 9a6f4e8c4b
[docs] design shuffle (#2951)
This PR incorporates design tweaks from #2922 without the home page or
content changes.

These are:
- Replacing all `hello@tldraw.com` with `sales@tldraw.com`
- Fix mailto links.
- Showing the first item in a section on direct routes to the section
- Splitting the article page for human-written content from article page
for generated content
- Splitting the layout for the landing page from the rest of the site
(temporarily identical to the regular content)
- Removing headings from left sidebar
- Restoring headings in right sidebar for human-written pages with > 1
heading link
- Styling block quote
- Adjusting section link appearance / layout in header / menu
- Changing the order of search results to preference docs over examples
- Updating copy on events
- Removing copy on user interface menus
- Adding hero as prop to all articles
- Updated icon
- Fixing a few broken links
- Replaces the sandpack code blocks with hljs code blocks, except in
examples.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2024-02-29 16:28:45 +00:00

83 lines
1.9 KiB
TypeScript

'use client'
import Link from 'next/link'
import { Icon } from './Icon'
import { Search } from './Search'
import { ThemeSwitcher } from './ThemeSwitcher'
export function Header({ sectionId }: { sectionId?: string }) {
return (
<div className="layout__header">
<div className="layout__header__left">
<Link href="/quick-start">
<img className="logo-dark" src="/tldraw_dev_dark.png" />
<img className="logo-light" src="/tldraw_dev_light.png" />
</Link>
</div>
<Search />
<div className="layout__header__links">
<div className="layout__header__sections">
<SectionLinks sectionId={sectionId} />
</div>
<div className="layout__header__socials">
<a
href="https://x.com/tldraw/"
className="sidebar__button icon-button"
title="twitter"
target="_blank"
>
<Icon icon="twitter" />
</a>
<a
href="https://discord.com/invite/SBBEVCA4PG"
className="sidebar__button icon-button"
title="discord"
target="_blank"
>
<Icon icon="discord" />
</a>
<a
href="https://github.com/tldraw/tldraw"
className="sidebar__button icon-button"
title="github"
target="_blank"
>
<Icon icon="github" />
</a>
<ThemeSwitcher />
</div>
</div>
</div>
)
}
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
href="/examples/basic/basic"
title="Examples"
data-active={sectionId === 'examples'}
className="layout_header__section"
>
Examples
</a>
</>
)
}