Skip to content

Commit 18345f4

Browse files
committed
improve title again and add back button
1 parent 231f14c commit 18345f4

File tree

3 files changed

+82
-16
lines changed

3 files changed

+82
-16
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
3+
---
4+
5+
<style>
6+
button {
7+
backdrop-filter: blur(2px);
8+
height: 44px;
9+
width: 44px;
10+
border-radius: 100px;
11+
display: flex;
12+
align-items: center;
13+
justify-content: center;
14+
padding: 0.25rem 0.25rem;
15+
border: none;
16+
font-family: inherit;
17+
font-variation-settings: inherit;
18+
text-decoration: none;
19+
font-weight: 600;
20+
color: inherit;
21+
font-size: inherit;
22+
background-color: oklch(from var(--accent-color) 0.98 0.03 h / 90%);
23+
box-shadow:
24+
0 0.3rem 0.3rem rgba(0, 0, 0, 0.1),
25+
0 0 1rem rgba(0, 0, 0, 0.05),
26+
inset 0 1px 1px rgba(255, 255, 255, 0.5),
27+
inset 0 0 0.27rem rgba(255, 255, 255, 0.5);
28+
29+
@media (prefers-color-scheme: dark) {
30+
background-color: oklch(from var(--accent-color) 0.24 0.017 h / 90%);
31+
box-shadow:
32+
0 0.3rem 0.3rem rgba(0, 0, 0, 0.1),
33+
0 0 1rem rgba(0, 0, 0, 0.05),
34+
inset 0 1px 1px oklch(1 0 0 / 0.1),
35+
inset 0 0 0.27rem rgba(255, 255, 255, 0.1);
36+
}
37+
}
38+
39+
svg {
40+
width: 20px;
41+
height: 20px;
42+
fill: currentColor;
43+
padding-right: 2px;
44+
}
45+
</style>
46+
47+
<button onClick="window.history.back()">
48+
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
49+
<path
50+
d="m 12 2 c 0 -0.265625 -0.105469 -0.519531 -0.292969 -0.707031 c -0.390625 -0.390625 -1.023437 -0.390625 -1.414062 0 l -6 6 c -0.1875 0.1875 -0.292969 0.441406 -0.292969 0.707031 s 0.105469 0.519531 0.292969 0.707031 l 6 6 c 0.390625 0.390625 1.023437 0.390625 1.414062 0 c 0.1875 -0.1875 0.292969 -0.441406 0.292969 -0.707031 s -0.105469 -0.519531 -0.292969 -0.707031 l -5.292969 -5.292969 l 5.292969 -5.292969 c 0.1875 -0.1875 0.292969 -0.441406 0.292969 -0.707031 z m 0 0"
51+
fill="currentColor"></path>
52+
</svg>
53+
</button>

src/components/Navigation/Headerbar.astro

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
import AccentButton from "./AccentButton.astro";
33
import TabBarLarge from "./TabBarLarge.astro";
4+
import BackButton from "./BackButton.astro";
45
56
const { pageTitle } = Astro.props;
7+
const showBackButton = Astro.url.pathname !== "/";
68
---
79

810
<style>
@@ -12,59 +14,66 @@ const { pageTitle } = Astro.props;
1214
padding: 19px;
1315
position: sticky;
1416
top: 0;
15-
align-items: stretch;
17+
align-items: center;
1618
z-index: 1;
19+
gap: calc(19px / 2);
1720

18-
.centre,
1921
.leading,
22+
.centre,
2023
.trailing {
2124
display: flex;
22-
flex-grow: 1;
23-
flex-basis: 0;
25+
align-items: center;
2426
}
2527

26-
.centre {
28+
.leading,
29+
.trailing {
30+
width: 44px;
2731
justify-content: center;
28-
align-items: center;
29-
flex-grow: 2;
3032
}
3133

32-
.trailing {
33-
justify-content: right;
34+
.centre {
35+
flex: 1 1 auto;
36+
justify-content: center;
37+
min-width: 0;
38+
gap: 8px;
3439
}
3540

3641
.titlebox {
3742
display: none;
38-
margin: 0;
39-
font-size: 14px;
40-
font-weight: 500;
43+
font-size: 18px;
44+
font-weight: 590;
4145
text-align: center;
4246
background-color: oklch(from var(--accent-color) 0.98 0.03 h / 90%);
4347
padding: 4px 16px;
4448
border-radius: 100px;
4549
backdrop-filter: blur(2px);
46-
4750
justify-content: center;
4851
align-items: center;
4952
height: 44px;
5053
box-sizing: border-box;
51-
54+
flex-shrink: 1;
55+
min-width: 0;
5256
box-shadow:
5357
0 0.3rem 0.3rem rgba(0, 0, 0, 0.1),
5458
0 0 1rem rgba(0, 0, 0, 0.05),
5559
inset 0 1px 1px rgba(255, 255, 255, 0.5),
5660
inset 0 0 0.27rem rgba(255, 255, 255, 0.5);
5761
}
62+
5863
.headerbar-title {
5964
display: inline-block;
6065
margin: 0;
61-
line-height: 118%;
66+
white-space: nowrap;
67+
overflow: hidden;
68+
text-overflow: ellipsis;
6269
}
6370
}
6471
</style>
6572

6673
<div id="header-bar">
67-
<div class="leading"></div>
74+
<div class="leading">
75+
{showBackButton && <BackButton />}
76+
</div>
6877
<div class="centre">
6978
<TabBarLarge />
7079
<div class="titlebox">
Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)