Skip to content

Commit 426244e

Browse files
author
LinuxJava7
committed
add bottom view switcher bar for mobile view and improve styling
1 parent 57dcf20 commit 426244e

File tree

2 files changed

+120
-4
lines changed

2 files changed

+120
-4
lines changed

index.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,39 @@
5353
</ul>
5454
</nav>
5555
</header>
56+
57+
<div class="view-switcher-bar">
58+
<!-- Navigation (View Switcher) -->
59+
<nav class="view-switcher-narrow">
60+
<ul>
61+
<li>
62+
<a href="/" class="current" aria-current="page">
63+
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
64+
<g fill="currentColor">
65+
<path d="m 12 16 c 1.660156 0 3 -1.339844 3 -3 v -6 c 0 -0.929688 -0.414062 -1.8125 -1.128906 -2.410156 l -4.460938 -3.71875 c -0.816406 -0.679688 -2.003906 -0.679688 -2.820312 0 l -4.460938 3.71875 c -0.714844 0.597656 -1.128906 1.480468 -1.128906 2.410156 v 6 c 0 1.660156 1.339844 3 3 3 z m -9 -3 v -6 c 0 -0.335938 0.148438 -0.65625 0.410156 -0.871094 l 4.460938 -3.71875 c 0.074218 -0.0625 0.183594 -0.0625 0.257812 0 l 4.460938 3.71875 c 0.261718 0.214844 0.410156 0.535156 0.410156 0.871094 v 6 c 0 0.546875 -0.453125 1 -1 1 h -8 c -0.546875 0 -1 -0.453125 -1 -1 z m 0 0"/>
66+
<path d="m 7 8 h 2 c 0.550781 0 1 0.449219 1 1 v 5 c 0 0.550781 -0.449219 1 -1 1 h -2 c -0.550781 0 -1 -0.449219 -1 -1 v -5 c 0 -0.550781 0.449219 -1 1 -1 z m 0 0"/>
67+
</g>
68+
</svg>
69+
70+
Home
71+
</a>
72+
</li>
73+
<li>
74+
<a href="https://blog.linuxjava7.dev/">
75+
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
76+
<g fill="currentColor">
77+
<path d="m 4.199219 2 c -0.453125 0 -0.84375 0.300781 -0.964844 0.738281 l -3.234375 11.261719 h 2.066406 l 0.808594 -3 l 2.125 -0.003906 l 2.121094 0.003906 l 0.808594 3 h 2.070312 l -3.238281 -11.261719 c -0.117188 -0.4375 -0.511719 -0.738281 -0.960938 -0.738281 z m 0.785156 2 h 0.015625 h 0.011719 c 0.121093 -0.003906 0.238281 0.011719 0.289062 0.207031 l 1.320313 4.792969 h -3.242188 l 1.316406 -4.792969 c 0.054688 -0.195312 0.171876 -0.210937 0.289063 -0.207031 z m 0 0"/><path d="m 10 0 v 1 h 2 v 14 h -2 v 1 h 2.5 l 0.5 -0.5 l 0.5 0.5 h 2.5 v -1 h -2 v -14 h 2 v -1 h -2.5 l -0.5 0.5 l -0.5 -0.5 z m 0 0"/>
78+
</g>
79+
</svg>
80+
81+
My Blog
82+
</a>
83+
</li>
84+
<li><a href="/test2">Test 2</a></li>
85+
</ul>
86+
</nav>
87+
</div>
88+
5689
<!-- Main Content -->
5790
<div class="container" id="intro">
5891
<h1>LinuxJava7</h1>

style.css

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,79 @@ a[href^="http"]:not(:has(.arrow)):not(:has(img)):not(:has(svg))::after {
307307
fill: currentColor;
308308
}
309309

310+
/* View Switcher Bar */
311+
.view-switcher-bar {
312+
display: none;
313+
justify-content: center;
314+
align-items: center;
315+
height: 3.3rem;
316+
width: 100%;
317+
position: fixed;
318+
bottom: 0;
319+
padding: 0;
320+
background-color: rgba(var(--ctp-base) / 75%);
321+
backdrop-filter: blur(12px);
322+
z-index: 9999;
323+
}
324+
325+
/* View Switcher */
326+
.view-switcher-narrow {
327+
display: flex;
328+
justify-content: center;
329+
padding: 0;
330+
height: 85%
331+
}
332+
333+
.view-switcher-narrow ul {
334+
display: flex;
335+
list-style: none;
336+
margin: 0;
337+
padding: 0;
338+
gap: 0.25rem;
339+
}
340+
341+
.view-switcher-narrow li {
342+
display: inline-block;
343+
}
344+
345+
.view-switcher-narrow a {
346+
display: flex;
347+
align-items: center;
348+
justify-content: center;
349+
flex-direction: column;
350+
width: 6.8rem;
351+
height: 100%;
352+
color: var(--ctp-text);
353+
font-weight: bold;
354+
text-decoration: none;
355+
border-radius: 0.6rem;
356+
transition: background-color 0.2s ease, color 0.2s ease;
357+
gap: 0px;
358+
font-size: 0.8rem;
359+
}
360+
361+
.view-switcher-narrow a:hover,
362+
.view-switcher-narrow a:focus {
363+
background-color: rgb(0 0 0 / 2.5%);
364+
}
365+
366+
.view-switcher-narrow .current {
367+
background-color: rgb(0 0 0 / 5%);
368+
}
369+
370+
.view-switcher-narrow svg {
371+
width: 1.25em;
372+
height: auto;
373+
margin-top: 4px;
374+
}
375+
376+
310377
/* Header Bar */
311378
.headerbar {
312379
display: flex;
313380
justify-content: center;
314381
align-items: center;
315-
height: 2.9375rem;
382+
height: 3rem;
316383
width: 100%;
317384
position: sticky;
318385
top: 0;
@@ -351,7 +418,7 @@ a[href^="http"]:not(:has(.arrow)):not(:has(img)):not(:has(svg))::after {
351418
color: var(--ctp-text);
352419
font-weight: bold;
353420
text-decoration: none;
354-
border-radius: 0.5rem;
421+
border-radius: 0.65rem;
355422
transition: background-color 0.2s ease, color 0.2s ease;
356423
gap: 6px;
357424
}
@@ -412,11 +479,15 @@ footer {
412479
}
413480

414481
.view-switcher a:hover,
415-
.view-switcher a:focus {
482+
.view-switcher a:focus,
483+
.view-switcher-narrow a:hover,
484+
.view-switcher-narrow a:focus
485+
{
416486
background-color: rgb(255 255 255 / 2.5%);
417487
}
418488

419-
.view-switcher .current {
489+
.view-switcher .current
490+
.view-switcher-narrow .current{
420491
background-color: rgb(255 255 255 / 5%);
421492
}
422493
}
@@ -429,6 +500,18 @@ footer {
429500
--grid-gap: 1rem;
430501
--defaultsize: 16px;
431502
}
503+
504+
.headerbar {
505+
display: none;
506+
}
507+
508+
.view-switcher-bar {
509+
display: flex;
510+
}
511+
512+
footer {
513+
margin-bottom: 3.5rem;
514+
}
432515

433516
.container {
434517
grid-template-columns: [full-start] minmax(0, 1fr) [main-start] repeat(2,minmax(1rem,calc(var(--pagewidth)/2))) [main-end] minmax(0, 1fr) [full-end];

0 commit comments

Comments
 (0)