diff options
| author | Dax Raad <[email protected]> | 2025-05-30 20:47:56 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-30 20:48:36 -0400 |
| commit | f3da73553c45f17e04b1e77cb13eb0fca714d1bd (patch) | |
| tree | a24317a19e1ab2a89da50db669dc6894f15d00d1 /packages/web/src/components/Header.astro | |
| parent | 9a26b3058ffc1023e5c7e54b6d571c903d15888e (diff) | |
| download | opencode-f3da73553c45f17e04b1e77cb13eb0fca714d1bd.tar.gz opencode-f3da73553c45f17e04b1e77cb13eb0fca714d1bd.zip | |
sync
Diffstat (limited to 'packages/web/src/components/Header.astro')
| -rw-r--r-- | packages/web/src/components/Header.astro | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/packages/web/src/components/Header.astro b/packages/web/src/components/Header.astro new file mode 100644 index 000000000..a45899ff8 --- /dev/null +++ b/packages/web/src/components/Header.astro @@ -0,0 +1,62 @@ +--- +import config from 'virtual:starlight/user-config'; +import { Icon } from '@astrojs/starlight/components'; +import { HeaderLinks } from 'toolbeam-docs-theme/components'; +import Default from 'toolbeam-docs-theme/overrides/Header.astro'; +import SiteTitle from '@astrojs/starlight/components/SiteTitle.astro'; + +const path = Astro.url.pathname; + +const links = config.social || []; +--- + +{ path.startsWith("/share") + ? <div class="header sl-flex"> + <div class="title-wrapper sl-flex"> + <SiteTitle {...Astro.props} /> + </div> + <div class="middle-group sl-flex"> + <HeaderLinks {...Astro.props} /> + </div> + </div> + : <Default {...Astro.props}><slot /></Default> +} + +<style> + .header { + justify-content: space-between; + align-items: center; + height: 100%; + } + + .title-wrapper { + /* Prevent long titles overflowing and covering the search and menu buttons on narrow viewports. */ + overflow: clip; + /* Avoid clipping focus ring around link inside title wrapper. */ + padding: calc(0.25rem + 2px) 0.25rem calc(0.25rem - 2px); + margin: -0.25rem; + } + + .middle-group { + justify-content: flex-end; + gap: var(--sl-nav-gap); + } + @media (max-width: 50rem) { + :global(:root[data-has-sidebar]) { + .middle-group { + display: none; + } + } + } + @media (min-width: 50rem) { + .middle-group { + display: flex; + } + } +</style> +<style is:global> +body > div.page > header { + border-color: var(--sl-color-divider); +} +</style> + |
