Skip to content

Commit 6d4d469

Browse files
admdlyCopilot
andauthored
Refactor Header layout and responsive styles (#17)
* Refactor Header layout and responsive styles * Fix mobile header height to prevent stacked layout clipping Agent-Logs-Url: https://github.com/FOSSBilling/docs/sessions/24d8ecb7-d407-4b82-b2f4-e30bbb19d242 Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
1 parent d4804f0 commit 6d4d469

1 file changed

Lines changed: 59 additions & 80 deletions

File tree

src/components/starlight/Header.astro

Lines changed: 59 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,72 @@ import Search from 'virtual:starlight/components/Search';
44
import SiteTitle from 'virtual:starlight/components/SiteTitle';
55
import SocialIcons from 'virtual:starlight/components/SocialIcons';
66
import ThemeSelect from 'virtual:starlight/components/ThemeSelect';
7-
8-
const navLinks = [
9-
{ label: 'Documentation', href: '/' },
10-
{ label: 'Downloads', href: 'https://fossbilling.org/downloads' },
11-
{ label: 'Demo', href: 'https://fossbilling.org/demo' },
12-
{ label: 'Translate', href: 'https://translate.fossbilling.org/' },
13-
{
14-
label: 'Donate',
15-
href: 'https://opencollective.com/fossbilling',
16-
cta: true,
17-
},
18-
];
19-
20-
const currentPath = Astro.url.pathname.replace(/\/+$/, '') || '/';
217
---
228

239
<div class="fb-header">
2410
<div class="fb-header__brand">
2511
<SiteTitle />
12+
<span class="fb-header__title">Docs</span>
2613
</div>
2714

28-
<nav class="fb-header__nav" aria-label="Primary">
29-
{
30-
navLinks.map(({ label, href, cta }) => (
31-
<a
32-
href={href}
33-
class:list={[
34-
'fb-header__link',
35-
{
36-
'is-active': href === '/' && currentPath.startsWith('/'),
37-
'is-cta': cta,
38-
},
39-
]}
40-
>
41-
{label}
42-
</a>
43-
))
44-
}
45-
</nav>
46-
47-
<div class="fb-header__search">
48-
<Search />
49-
</div>
15+
<div class="fb-header__tools">
16+
<div class="fb-header__search">
17+
<Search />
18+
</div>
5019

51-
<div class="fb-header__actions">
52-
<div class="fb-header__social">
53-
<SocialIcons />
20+
<div class="fb-header__actions">
21+
<div class="fb-header__social">
22+
<SocialIcons />
23+
</div>
24+
<ThemeSelect />
25+
<LanguageSelect />
5426
</div>
55-
<ThemeSelect />
56-
<LanguageSelect />
5727
</div>
5828
</div>
5929

6030
<style>
6131
.fb-header {
62-
display: grid;
63-
grid-template-columns: minmax(0, auto) 1fr;
32+
display: flex;
33+
flex-direction: column;
34+
justify-content: center;
6435
align-items: center;
65-
gap: 0.75rem 1rem;
66-
height: 100%;
36+
gap: 0.75rem;
37+
height: auto;
6738
}
6839

6940
.fb-header__brand {
41+
display: flex;
42+
align-items: center;
43+
gap: 0.875rem;
7044
min-width: 0;
45+
width: 100%;
46+
overflow: clip;
47+
padding: 0.25rem;
48+
margin: -0.25rem;
7149
}
7250

73-
.fb-header__search {
74-
grid-column: 1 / -1;
51+
.fb-header__title {
52+
display: inline-flex;
53+
align-items: center;
54+
flex-shrink: 0;
55+
border-inline-start: 1px solid var(--sl-color-gray-5);
56+
padding-inline-start: 0.875rem;
57+
color: var(--sl-color-gray-2);
58+
font-size: 0.8rem;
59+
font-weight: 700;
60+
letter-spacing: 0.12em;
61+
text-transform: uppercase;
7562
}
7663

77-
.fb-header__nav,
78-
.fb-header__actions {
79-
display: none;
64+
.fb-header__tools {
65+
display: grid;
66+
grid-template-columns: minmax(0, 1fr);
67+
gap: 0.75rem;
68+
width: 100%;
69+
}
70+
71+
.fb-header__search {
72+
min-width: 0;
8073
}
8174

8275
.fb-header__social {
@@ -85,50 +78,36 @@ const currentPath = Astro.url.pathname.replace(/\/+$/, '') || '/';
8578
gap: 0.25rem;
8679
}
8780

88-
.fb-header__link {
89-
color: var(--sl-color-gray-3);
90-
font-size: 0.98rem;
91-
font-weight: 500;
92-
text-decoration: none;
93-
transition: color 0.2s ease;
94-
}
95-
96-
.fb-header__link:hover,
97-
.fb-header__link.is-active {
98-
color: var(--sl-color-white);
99-
}
100-
101-
.fb-header__link.is-cta {
102-
color: var(--sl-color-white);
81+
.fb-header__actions {
82+
display: none;
10383
}
10484

10585
@media (min-width: 50rem) {
10686
.fb-header {
107-
grid-template-columns: minmax(0, auto) minmax(14rem, 1fr) auto;
108-
gap: 1rem;
87+
display: grid;
88+
grid-template-columns: minmax(0, auto) minmax(0, 1fr);
89+
gap: 1rem 1.25rem;
90+
height: 100%;
10991
}
11092

111-
.fb-header__search {
112-
grid-column: auto;
93+
.fb-header__tools {
94+
grid-template-columns: minmax(14rem, 22rem) auto;
95+
align-items: center;
96+
justify-content: end;
97+
justify-self: end;
98+
width: auto;
99+
max-width: 100%;
113100
}
114101

115102
.fb-header__actions {
116103
display: flex;
117104
align-items: center;
118105
gap: 0.75rem;
119106
}
120-
}
121-
122-
@media (min-width: 72rem) {
123-
.fb-header {
124-
grid-template-columns: minmax(12rem, auto) auto minmax(14rem, 1fr) auto;
125-
gap: 1.25rem;
126-
}
127107

128-
.fb-header__nav {
129-
display: flex;
130-
align-items: center;
131-
gap: 1.5rem;
108+
.fb-header__social {
109+
padding-inline-end: 0.875rem;
110+
border-inline-end: 1px solid var(--sl-color-gray-5);
132111
}
133112
}
134113
</style>

0 commit comments

Comments
 (0)