summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/components/Header.astro
blob: a45899ff8b419156036b93bb0ecf15a117adf2bb (plain)
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
---
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>