mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-07 00:34:41 +00:00
feat: add login navbar link, hide some nav links on mobile
This commit is contained in:
parent
0ee1139cf1
commit
8c7eb767bc
2 changed files with 18 additions and 2 deletions
|
@ -4,6 +4,8 @@ import { usePathname } from "next/navigation";
|
||||||
|
|
||||||
export const Navbar = () => {
|
export const Navbar = () => {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
const isNotAuthorizedStyle = "text-gray-700"
|
||||||
const navLinks = [
|
const navLinks = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
@ -11,6 +13,8 @@ export const Navbar = () => {
|
||||||
iconActive: "material-symbols--home",
|
iconActive: "material-symbols--home",
|
||||||
title: "Домашняя",
|
title: "Домашняя",
|
||||||
href: "/",
|
href: "/",
|
||||||
|
withAuthOnly: false,
|
||||||
|
mobileMenu: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
|
@ -18,6 +22,8 @@ export const Navbar = () => {
|
||||||
iconActive: "material-symbols--search",
|
iconActive: "material-symbols--search",
|
||||||
title: "Поиск",
|
title: "Поиск",
|
||||||
href: "/search",
|
href: "/search",
|
||||||
|
withAuthOnly: false,
|
||||||
|
mobileMenu: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
|
@ -25,6 +31,8 @@ export const Navbar = () => {
|
||||||
iconActive: "material-symbols--bookmarks",
|
iconActive: "material-symbols--bookmarks",
|
||||||
title: "Закладки",
|
title: "Закладки",
|
||||||
href: "/bookmarks",
|
href: "/bookmarks",
|
||||||
|
withAuthOnly: true,
|
||||||
|
mobileMenu: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
|
@ -32,6 +40,8 @@ export const Navbar = () => {
|
||||||
iconActive: "material-symbols--favorite",
|
iconActive: "material-symbols--favorite",
|
||||||
title: "Избранное",
|
title: "Избранное",
|
||||||
href: "/favorites",
|
href: "/favorites",
|
||||||
|
withAuthOnly: true,
|
||||||
|
mobileMenu: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
|
@ -39,17 +49,23 @@ export const Navbar = () => {
|
||||||
iconActive: "material-symbols--history",
|
iconActive: "material-symbols--history",
|
||||||
title: "История",
|
title: "История",
|
||||||
href: "/history",
|
href: "/history",
|
||||||
|
withAuthOnly: true,
|
||||||
|
mobileMenu: true
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="fixed bottom-0 left-0 z-50 w-full text-white bg-black sm:sticky sm:top-0">
|
<header className="fixed bottom-0 left-0 z-50 w-full text-white bg-black sm:sticky sm:top-0">
|
||||||
<div className="px-4 py-4">
|
<div className="flex items-center justify-between px-4 py-4">
|
||||||
<nav className="flex gap-4">
|
<nav className="flex gap-4">
|
||||||
{navLinks.map((link) => {
|
{navLinks.map((link) => {
|
||||||
return <Link key={link.id} href={link.href} className="flex flex-col items-center sm:flex-row"><span className={`iconify ${pathname == link.href ? link.iconActive : link.icon} w-6 h-6`}></span><span className={`${pathname == link.href ? "font-bold" : ""} text-xs sm:text-base`}>{link.title}</span></Link>;
|
return <Link key={link.id} href={link.href} className={`flex-col items-center sm:flex-row ${link.mobileMenu ? "hidden sm:flex" : "flex"}`}><span className={`iconify ${pathname == link.href ? link.iconActive : link.icon} w-6 h-6`}></span><span className={`${pathname == link.href ? "font-bold" : ""} text-xs sm:text-base`}>{link.title}</span></Link>;
|
||||||
})}
|
})}
|
||||||
</nav>
|
</nav>
|
||||||
|
<Link href="/login" className="flex flex-col items-center gap-1 justify-cen ter sm:flex-row">
|
||||||
|
<span className={`w-6 h-6 iconify ${pathname == "/login" ? "mdi--user-circle" : "mdi--user-circle-outline"}`}></span>
|
||||||
|
<span className={`${pathname == "/login" ? "font-bold" : ""} text-xs sm:text-base`}>Войти</span>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
|
|
0
app/store/auth.js
Normal file
0
app/store/auth.js
Normal file
Loading…
Add table
Reference in a new issue