Spaces:
Running
Running
File size: 6,504 Bytes
8b26d10 | 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 | class ThaiNavbar extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.render();
}
render() {
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 40;
}
nav {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(255, 255, 255, 0.18);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
padding: 1rem;
}
.dark nav {
background: rgba(15, 23, 42, 0.9);
border-color: rgba(255, 255, 255, 0.08);
}
.container {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.logo {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 700;
color: #7c3aed;
text-decoration: none;
}
.dark .logo {
color: #c4b5fd;
}
.nav-links {
display: flex;
gap: 1rem;
align-items: center;
}
button {
background: none;
border: none;
cursor: pointer;
padding: 0.5rem;
border-radius: 0.5rem;
transition: all 0.2s;
}
button:hover {
background: rgba(124, 58, 237, 0.1);
}
.dark button:hover {
background: rgba(196, 181, 253, 0.1);
}
.icon {
width: 1.5rem;
height: 1.5rem;
stroke: #7c3aed;
}
.dark .icon {
stroke: #c4b5fd;
}
.badge {
position: absolute;
top: -4px;
right: -4px;
background: #ef4444;
color: white;
font-size: 0.625rem;
padding: 0.125rem 0.375rem;
border-radius: 9999px;
font-weight: 600;
}
.relative {
position: relative;
}
@media (max-width: 640px) {
nav {
padding: 0.75rem;
}
.logo {
font-size: 1rem;
}
.nav-links {
gap: 0.5rem;
}
}
</style>
<nav>
<div class="container">
<a href="/" class="logo">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
<polyline points="9 22 9 12 15 12 15 22"></polyline>
</svg>
ชีพจร Pulse
</a>
<div class="nav-links">
<button id="theme-toggle" aria-label="Toggle theme">
<svg class="icon" id="theme-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
<div class="relative">
<button aria-label="Notifications">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
</svg>
</button>
<span class="badge">3</span>
</div>
<button aria-label="Settings">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="3"></circle>
<path d="M12 1v6m0 6v6m4.22-10.22l1.42-1.42M6.36 17.64l1.42-1.42M1 12h6m6 0h6m-10.22 4.22l-1.42 1.42M17.64 6.36l-1.42 1.42"></path>
</svg>
</button>
</div>
</div>
</nav>
`;
}
}
customElements.define('thai-navbar', ThaiNavbar); |