Spaces:
Sleeping
Sleeping
axeronis commited on
Commit ·
445b18b
1
Parent(s): e8b1306
feat: expensive glass UI, fixed drag cursor, and ultra-neon scrollbar
Browse files
frontend/components/Header.tsx
CHANGED
|
@@ -57,7 +57,7 @@ export function Header() {
|
|
| 57 |
}
|
| 58 |
|
| 59 |
return (
|
| 60 |
-
<header className="hidden md:flex h-16 border-b border-white/10 md:border-b-0 lg:border-b lg:border-white/10 bg-black/
|
| 61 |
{/* Left: Logo (Visible only when sidebar is hidden i.e. < lg) */}
|
| 62 |
<div className="flex items-center gap-2 lg:hidden">
|
| 63 |
<Link href="/dashboard" className="flex items-center gap-2">
|
|
|
|
| 57 |
}
|
| 58 |
|
| 59 |
return (
|
| 60 |
+
<header className="hidden md:flex h-16 border-b border-white/10 md:border-b-0 lg:border-b lg:border-white/10 bg-black/20 backdrop-blur-3xl items-center justify-between px-6 sticky top-0 z-30">
|
| 61 |
{/* Left: Logo (Visible only when sidebar is hidden i.e. < lg) */}
|
| 62 |
<div className="flex items-center gap-2 lg:hidden">
|
| 63 |
<Link href="/dashboard" className="flex items-center gap-2">
|
frontend/components/SecondaryNav.tsx
CHANGED
|
@@ -79,8 +79,10 @@ export function SecondaryNav() {
|
|
| 79 |
setIsDragging(true)
|
| 80 |
setStartX(e.pageX - scrollContainerRef.current.offsetLeft)
|
| 81 |
setScrollLeft(scrollContainerRef.current.scrollLeft)
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
// Attach window listeners for drag
|
|
@@ -96,6 +98,8 @@ export function SecondaryNav() {
|
|
| 96 |
const handleWindowMouseUp = () => {
|
| 97 |
if (isDragging) {
|
| 98 |
setIsDragging(false)
|
|
|
|
|
|
|
| 99 |
if (scrollContainerRef.current) scrollContainerRef.current.style.cursor = 'grab'
|
| 100 |
}
|
| 101 |
}
|
|
@@ -108,36 +112,50 @@ export function SecondaryNav() {
|
|
| 108 |
return () => {
|
| 109 |
window.removeEventListener('mousemove', handleWindowMouseMove)
|
| 110 |
window.removeEventListener('mouseup', handleWindowMouseUp)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
}, [isDragging, startX, scrollLeft])
|
| 113 |
|
| 114 |
return (
|
| 115 |
-
<div className="hidden md:flex lg:hidden w-full h-14 bg-black/
|
| 116 |
{/* Custom Styles for Neon Scrollbar */}
|
| 117 |
<style jsx>{`
|
|
|
|
|
|
|
|
|
|
| 118 |
.aurora-scroll::-webkit-scrollbar {
|
| 119 |
-
height:
|
| 120 |
background: transparent;
|
| 121 |
}
|
| 122 |
.aurora-scroll::-webkit-scrollbar-track {
|
| 123 |
-
background:
|
| 124 |
}
|
| 125 |
.aurora-scroll::-webkit-scrollbar-thumb {
|
| 126 |
-
background: #6366f1;
|
| 127 |
border-radius: 99px;
|
| 128 |
-
/*
|
| 129 |
box-shadow:
|
| 130 |
-
0 0 10px
|
| 131 |
-
0 0 20px rgba(
|
| 132 |
-
inset 0 0
|
| 133 |
-
|
|
|
|
| 134 |
}
|
| 135 |
.aurora-scroll::-webkit-scrollbar-thumb:hover {
|
| 136 |
-
background: #818cf8;
|
| 137 |
box-shadow:
|
| 138 |
-
0 0 15px
|
| 139 |
-
0 0 30px rgba(129, 140, 248, 0.
|
| 140 |
-
inset 0 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
}
|
| 142 |
`}</style>
|
| 143 |
|
|
@@ -145,10 +163,9 @@ export function SecondaryNav() {
|
|
| 145 |
ref={scrollContainerRef}
|
| 146 |
onWheel={handleWheel}
|
| 147 |
onMouseDown={handleMouseDown}
|
| 148 |
-
className="flex items-center gap-1 px-4 overflow-x-auto w-full aurora-scroll cursor-grab active:cursor-grabbing
|
| 149 |
style={{
|
| 150 |
-
|
| 151 |
-
scrollbarColor: '#6366f1 transparent'
|
| 152 |
}}
|
| 153 |
>
|
| 154 |
{visibleItems.map((item) => {
|
|
@@ -160,15 +177,15 @@ export function SecondaryNav() {
|
|
| 160 |
key={item.href}
|
| 161 |
href={item.href}
|
| 162 |
data-active={active}
|
| 163 |
-
draggable={false}
|
| 164 |
className={cn(
|
| 165 |
-
"flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium whitespace-nowrap transition-all duration-
|
| 166 |
active
|
| 167 |
-
? "text-indigo-400 bg-
|
| 168 |
: "text-slate-400 hover:text-white hover:bg-white/5"
|
| 169 |
)}
|
| 170 |
>
|
| 171 |
-
<Icon className={cn("w-4 h-4", active ? "text-indigo-400" : "text-slate-500
|
| 172 |
<span>{t(item.labelKey) !== item.labelKey ? t(item.labelKey) : item.label}</span>
|
| 173 |
</Link>
|
| 174 |
)
|
|
|
|
| 79 |
setIsDragging(true)
|
| 80 |
setStartX(e.pageX - scrollContainerRef.current.offsetLeft)
|
| 81 |
setScrollLeft(scrollContainerRef.current.scrollLeft)
|
| 82 |
+
// Set body cursor to prevent flickering
|
| 83 |
+
document.body.style.cursor = 'grabbing'
|
| 84 |
+
document.body.style.userSelect = 'none'
|
| 85 |
+
scrollContainerRef.current.style.scrollBehavior = 'auto'
|
| 86 |
}
|
| 87 |
|
| 88 |
// Attach window listeners for drag
|
|
|
|
| 98 |
const handleWindowMouseUp = () => {
|
| 99 |
if (isDragging) {
|
| 100 |
setIsDragging(false)
|
| 101 |
+
document.body.style.cursor = ''
|
| 102 |
+
document.body.style.userSelect = ''
|
| 103 |
if (scrollContainerRef.current) scrollContainerRef.current.style.cursor = 'grab'
|
| 104 |
}
|
| 105 |
}
|
|
|
|
| 112 |
return () => {
|
| 113 |
window.removeEventListener('mousemove', handleWindowMouseMove)
|
| 114 |
window.removeEventListener('mouseup', handleWindowMouseUp)
|
| 115 |
+
if (isDragging) {
|
| 116 |
+
document.body.style.cursor = ''
|
| 117 |
+
document.body.style.userSelect = ''
|
| 118 |
+
}
|
| 119 |
}
|
| 120 |
}, [isDragging, startX, scrollLeft])
|
| 121 |
|
| 122 |
return (
|
| 123 |
+
<div className="hidden md:flex lg:hidden w-full h-14 bg-black/20 backdrop-blur-3xl border-t border-white/5 sticky top-16 z-20 shadow-2xl">
|
| 124 |
{/* Custom Styles for Neon Scrollbar */}
|
| 125 |
<style jsx>{`
|
| 126 |
+
.aurora-nav-container:hover .aurora-scroll::-webkit-scrollbar-thumb {
|
| 127 |
+
opacity: 1;
|
| 128 |
+
}
|
| 129 |
.aurora-scroll::-webkit-scrollbar {
|
| 130 |
+
height: 3px;
|
| 131 |
background: transparent;
|
| 132 |
}
|
| 133 |
.aurora-scroll::-webkit-scrollbar-track {
|
| 134 |
+
background: transparent;
|
| 135 |
}
|
| 136 |
.aurora-scroll::-webkit-scrollbar-thumb {
|
| 137 |
+
background: #6366f1;
|
| 138 |
border-radius: 99px;
|
| 139 |
+
/* Ultra Neon Glow */
|
| 140 |
box-shadow:
|
| 141 |
+
0 0 10px #6366f1,
|
| 142 |
+
0 0 20px rgba(99, 102, 241, 0.6),
|
| 143 |
+
inset 0 0 4px #818cf8;
|
| 144 |
+
cursor: pointer;
|
| 145 |
+
transition: all 0.3s ease;
|
| 146 |
}
|
| 147 |
.aurora-scroll::-webkit-scrollbar-thumb:hover {
|
| 148 |
+
background: #818cf8;
|
| 149 |
box-shadow:
|
| 150 |
+
0 0 15px #818cf8,
|
| 151 |
+
0 0 30px rgba(129, 140, 248, 0.8),
|
| 152 |
+
inset 0 0 6px #a5b4fc;
|
| 153 |
+
}
|
| 154 |
+
/* Smooth reveal on hover */
|
| 155 |
+
.aurora-scroll {
|
| 156 |
+
scrollbar-width: thin;
|
| 157 |
+
scrollbar-color: #6366f1 transparent;
|
| 158 |
+
transition: scrollbar-color 0.3s;
|
| 159 |
}
|
| 160 |
`}</style>
|
| 161 |
|
|
|
|
| 163 |
ref={scrollContainerRef}
|
| 164 |
onWheel={handleWheel}
|
| 165 |
onMouseDown={handleMouseDown}
|
| 166 |
+
className="aurora-nav-container flex items-center gap-1 px-4 overflow-x-auto w-full aurora-scroll cursor-grab active:cursor-grabbing select-none"
|
| 167 |
style={{
|
| 168 |
+
WebkitOverflowScrolling: 'touch'
|
|
|
|
| 169 |
}}
|
| 170 |
>
|
| 171 |
{visibleItems.map((item) => {
|
|
|
|
| 177 |
key={item.href}
|
| 178 |
href={item.href}
|
| 179 |
data-active={active}
|
| 180 |
+
draggable={false}
|
| 181 |
className={cn(
|
| 182 |
+
"flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium whitespace-nowrap transition-all duration-300 shrink-0",
|
| 183 |
active
|
| 184 |
+
? "text-indigo-400 bg-white/5 border border-white/10 shadow-[0_0_20px_rgba(99,102,241,0.1)]"
|
| 185 |
: "text-slate-400 hover:text-white hover:bg-white/5"
|
| 186 |
)}
|
| 187 |
>
|
| 188 |
+
<Icon className={cn("w-4 h-4", active ? "text-indigo-400" : "text-slate-500")} />
|
| 189 |
<span>{t(item.labelKey) !== item.labelKey ? t(item.labelKey) : item.label}</span>
|
| 190 |
</Link>
|
| 191 |
)
|