Revert "Mobilna navigacija: vodoravna vrstica rubrik namesto hamburger menija (kot na ONE)"
This reverts commit 23d780477a.
This commit is contained in:
parent
23d780477a
commit
164775f2b8
@ -1,5 +1,5 @@
|
|||||||
import { Link, useLocation } from "wouter";
|
import { Link, useLocation } from "wouter";
|
||||||
import { Search, X } from "lucide-react";
|
import { Menu, X, Search } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useState, useRef, useEffect } from "react";
|
import { useState, useRef, useEffect } from "react";
|
||||||
import folxLogo from "@assets/folx_MT_poz_b_1772296729169.png";
|
import folxLogo from "@assets/folx_MT_poz_b_1772296729169.png";
|
||||||
@ -17,6 +17,7 @@ const navItems = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
|
const [mobileOpen, setMobileOpen] = useState(false);
|
||||||
const [searchOpen, setSearchOpen] = useState(false);
|
const [searchOpen, setSearchOpen] = useState(false);
|
||||||
const [searchQuery, setSearchQuery] = useState("");
|
const [searchQuery, setSearchQuery] = useState("");
|
||||||
const [location, navigate] = useLocation();
|
const [location, navigate] = useLocation();
|
||||||
@ -98,39 +99,50 @@ export default function Header() {
|
|||||||
<Search className="w-4 h-4" />
|
<Search className="w-4 h-4" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className="md:hidden"
|
||||||
|
onClick={() => setMobileOpen(!mobileOpen)}
|
||||||
|
data-testid="button-mobile-menu"
|
||||||
|
>
|
||||||
|
{mobileOpen ? <X className="w-5 h-5" /> : <Menu className="w-5 h-5" />}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Mobilna navigacija: vodoravna vrstica rubrik, vedno vidna (kot na ONE),
|
{mobileOpen && (
|
||||||
namesto hamburger menija. Vodoravno drsenje brez vidnega drsnika. */}
|
<div className="md:hidden border-t border-card-border bg-card" data-testid="nav-mobile">
|
||||||
<nav
|
<nav className="flex flex-col p-4 gap-1">
|
||||||
className="md:hidden border-t border-card-border bg-card overflow-x-auto"
|
<form onSubmit={handleSearch} className="mb-2" data-testid="form-mobile-search">
|
||||||
style={{ scrollbarWidth: "none", msOverflowStyle: "none" }}
|
<div className="relative">
|
||||||
data-testid="nav-mobile-bar"
|
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
|
||||||
>
|
<input
|
||||||
<div className="flex items-stretch gap-1 px-3 py-1.5 w-max">
|
type="text"
|
||||||
{navItems.map((item) => {
|
value={searchQuery}
|
||||||
const active = location === item.href;
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
return (
|
placeholder="Artikel, Videos suchen..."
|
||||||
|
className="w-full pl-9 pr-3 py-2 bg-background border border-card-border rounded-md text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"
|
||||||
|
data-testid="input-mobile-search"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{navItems.map((item) => (
|
||||||
<Link key={item.href} href={item.href}>
|
<Link key={item.href} href={item.href}>
|
||||||
<span
|
<Button
|
||||||
className={
|
variant={location === item.href ? "default" : "ghost"}
|
||||||
"block whitespace-nowrap px-3 py-1.5 rounded-md text-[13px] font-semibold uppercase tracking-wide transition-colors " +
|
className="w-full justify-start"
|
||||||
(active
|
onClick={() => setMobileOpen(false)}
|
||||||
? "bg-primary text-primary-foreground"
|
|
||||||
: "text-foreground/80 hover:text-primary")
|
|
||||||
}
|
|
||||||
data-testid={`link-mobile-${item.label.toLowerCase().replace(/\s/g, "-")}`}
|
data-testid={`link-mobile-${item.label.toLowerCase().replace(/\s/g, "-")}`}
|
||||||
>
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</span>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
);
|
))}
|
||||||
})}
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
)}
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user