-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathBottomNav.css
More file actions
233 lines (192 loc) Β· 6.9 KB
/
Copy pathBottomNav.css
File metadata and controls
233 lines (192 loc) Β· 6.9 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/* βββ Mobile-first bottom navigation βββββββββββββββββββββββββββββββββββββββββ
*
* Design tokens from `src/index.css` and `src/utils/tokens.ts`.
* Responsive: hidden above 768β―px (`--bp-mobile`), fixed to viewport bottom.
*
* Accessibility:
* - All touch targets β₯ 44β―Γβ―44β―px (WCAG 2.5.5).
* - Active state uses colour + top-border + icon weight (not colour alone).
* - Focus-visible ring uses the shared `--focus-ring-color` token.
* - `aria-current="page"` is set on the active link by NavLink.
*
* Reduced motion:
* - The slide-up entrance animation is suppressed under
* `@media (prefers-reduced-motion: reduce)` and
* `[data-motion="reduced"]`.
*/
/* ββ Config ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
:root {
--bottom-nav-height: 64px;
--bottom-nav-bg: var(--surface, #161b22);
--bottom-nav-border: var(--border, #30363d);
--bottom-nav-accent: var(--accent, #58a6ff);
--bottom-nav-text: var(--muted, #8b949e);
--bottom-nav-text-active: var(--text, #e6edf3);
}
/* ββ Nav bar βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
.bottom-nav {
/* hidden on desktop by default; shown via media query */
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 900;
height: var(--bottom-nav-height);
padding: 0 env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
background: var(--bottom-nav-bg);
border-top: 1px solid var(--bottom-nav-border);
box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.25);
/* Flex layout for evenly spaced items */
display: flex;
align-items: stretch;
justify-content: space-around;
/* Entrance animation */
animation: bottom-nav-enter 0.3s ease-out both;
}
/* Show only on viewports β€β―768β―px */
@media (min-width: 769px) {
.bottom-nav {
display: none !important;
}
}
/* ββ Nav link ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
.bottom-nav__link {
flex: 1 1 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
min-height: 44px; /* WCAG 2.5.5 touch target */
min-width: 44px;
padding: 4px 6px;
text-decoration: none;
color: var(--bottom-nav-text);
border: none;
background: transparent;
cursor: pointer;
position: relative; /* positioning context for the active ::before indicator */
border-radius: 0;
transition: color 0.2s ease, background 0.2s ease;
-webkit-tap-highlight-color: transparent;
}
.bottom-nav__link:hover {
color: var(--bottom-nav-text-active);
background: rgba(88, 166, 255, 0.06);
}
.bottom-nav__link:active {
transform: translateY(1px);
}
/* Focus ring β matches the shared .focus-ring pattern */
.bottom-nav__link:focus-visible {
outline: 2px solid var(--focus-ring-color, var(--accent, #58a6ff));
outline-offset: -3px; /* inset so it's visible inside the bar */
border-radius: 4px;
}
/* ββ Active state ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
.bottom-nav__link--active {
color: var(--bottom-nav-accent);
}
.bottom-nav__link--active::before {
content: '';
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 24px;
height: 2px;
background: var(--bottom-nav-accent);
border-radius: 0 0 2px 2px;
}
/* ββ Icon ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
.bottom-nav__icon {
display: block;
flex-shrink: 0;
transition: stroke-width 0.2s ease;
}
/* ββ Label βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
.bottom-nav__label {
font-size: 0.65rem;
font-weight: 500;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
/* ββ Animation ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
@keyframes bottom-nav-enter {
from {
transform: translateY(100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
/* ββ Reduced motion ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
@media (prefers-reduced-motion: reduce) {
.bottom-nav {
animation: none;
}
.bottom-nav__link {
transition: none;
}
.bottom-nav__icon {
transition: none;
}
}
/* Reduced Motion Override (set via ReducedMotionContext) */
[data-motion="reduced"] .bottom-nav {
animation: none;
}
[data-motion="reduced"] .bottom-nav__link {
transition: none;
}
[data-motion="reduced"] .bottom-nav__icon {
transition: none;
}
/* ββ High contrast override ββββββββββββββββββββββββββββββββββββββββββββββββ */
[data-contrast="high"] .bottom-nav {
border-top-width: 2px;
border-top-color: var(--border, #ffffff);
box-shadow: none;
}
[data-contrast="high"] .bottom-nav__link--active::before {
height: 3px;
background: var(--accent, #7dd3fc);
}
/* ββ Forced-colours mode (Windows High Contrast) βββββββββββββββββββββββββββ */
@media (forced-colors: active) {
.bottom-nav {
border-top: 2px solid ButtonText;
}
.bottom-nav__link--active::before {
background: Highlight;
}
}
/* ββ Compact screens (β€β―480β―px) β hide labels, show only icons ββββββββββββ */
@media (max-width: 480px) {
.bottom-nav__label {
display: none;
}
.bottom-nav__link {
gap: 0;
}
}
/* ββ Landscape phones ββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
@media (max-height: 480px) and (orientation: landscape) {
:root {
--bottom-nav-height: 52px;
}
.bottom-nav__link {
flex-direction: row;
gap: 4px;
min-height: 40px;
}
.bottom-nav__label {
display: inline;
font-size: 0.7rem;
}
}