-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMistNavbar.jsx
More file actions
114 lines (106 loc) · 4.4 KB
/
Copy pathMistNavbar.jsx
File metadata and controls
114 lines (106 loc) · 4.4 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
import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { ListIcon, MagnifyingGlassIcon } from '@phosphor-icons/react';
import { MistOrb, MistHorizon } from './mist';
import { useSiteConfig } from '../context/SiteConfigContext';
/**
* Masthead for the Mist theme — a pale band of fog that thickens
* faintly when you scroll. The orb glyph + serif wordmark on the left,
* lowercase mono whispers on the right. No hard rules anywhere; the
* bottom edge is a horizon that dissolves at both ends.
*/
const MistNavbar = ({
toggleSidebar,
isSidebarOpen,
isSearchVisible,
toggleSearch,
}) => {
const { config } = useSiteConfig();
const [scrolled, setScrolled] = useState(false);
useEffect(() => {
const onScroll = () => setScrolled(window.scrollY > 24);
window.addEventListener('scroll', onScroll);
return () => window.removeEventListener('scroll', onScroll);
}, []);
const title = config?.hero?.title || 'Fezcodex';
return (
<header
className={`sticky top-0 z-40 bg-[#EEF2F1]/80 backdrop-blur-md selection:bg-[#8FA8BC]/30 transition-shadow duration-300 ${
scrolled
? 'shadow-[0_18px_50px_rgba(60,72,69,0.10)]'
: 'shadow-none'
}`}
>
<div className="mx-auto max-w-[1800px] px-5 md:px-12">
<div className="grid grid-cols-[auto_1fr_auto] items-center gap-6 py-3.5">
{/* left: toggle + wordmark */}
<div className="flex items-center gap-4 md:gap-6 min-w-0">
<button
type="button"
onClick={toggleSidebar}
aria-label="Toggle sidebar"
className="text-[#5C6B67] hover:text-[#5F837B] transition-colors duration-[250ms]"
>
<ListIcon size={20} weight="light" />
</button>
<Link
to="/"
className="flex items-center gap-2.5 group min-w-0"
aria-label={title}
>
<MistOrb size={20} breathe={false} />
<span className="font-instr-serif text-[21px] md:text-[23px] text-[#3C4845] group-hover:text-[#5F837B] transition-colors duration-[250ms] truncate">
{title}
<span aria-hidden="true" className="text-[#8FA8BC]">
.
</span>
</span>
</Link>
</div>
{/* center: fog slug — shown only when sidebar closed */}
{!isSidebarOpen && (
<div className="hidden lg:block text-center font-ibm-plex-mono text-[10.5px] tracking-[0.22em] lowercase text-[#8A9894]">
visibility: low ·{' '}
{config?.kernel?.codename?.toLowerCase()}
</div>
)}
{isSidebarOpen && <span aria-hidden="true" />}
{/* right: about + search + kbd chip */}
<div className="flex items-center gap-3 md:gap-5 justify-end">
<Link
to="/about"
className="hidden md:inline font-ibm-plex-mono text-[10.5px] tracking-[0.22em] lowercase text-[#5C6B67] hover:text-[#5F837B] transition-colors duration-[250ms]"
>
about
</Link>
<button
type="button"
onClick={toggleSearch}
aria-label="Toggle search"
aria-expanded={Boolean(isSearchVisible)}
className="flex items-center gap-2 text-[#5C6B67] hover:text-[#5F837B] transition-colors duration-[250ms]"
>
<MagnifyingGlassIcon size={18} weight="light" />
<span className="hidden md:inline font-ibm-plex-mono text-[10.5px] tracking-[0.22em] lowercase">
search
</span>
</button>
<span
aria-hidden="true"
className="hidden md:inline-flex items-center gap-1 font-ibm-plex-mono text-[10px] tracking-[0.14em] lowercase text-[#8A9894]"
>
<kbd className="px-1.5 py-0.5 rounded-md bg-white/40 backdrop-blur-sm shadow-[0_4px_14px_rgba(60,72,69,0.08)]">
⌘
</kbd>
<kbd className="px-1.5 py-0.5 rounded-md bg-white/40 backdrop-blur-sm shadow-[0_4px_14px_rgba(60,72,69,0.08)]">
k
</kbd>
</span>
</div>
</div>
</div>
<MistHorizon tint={scrolled ? 'rgba(60,72,69,0.20)' : 'rgba(60,72,69,0.12)'} />
</header>
);
};
export default MistNavbar;