True_Kart / src /components /Layout.tsx
naturality-abhirsc
Rebuild HealthCart app with Vite React Tailwind stack
bcb3d07
Raw History Blame Contribute Delete
1.97 kB
import { Leaf, Home, ScanLine, ListChecks, User } from "lucide-react";
import { Link, NavLink, Outlet } from "react-router-dom";
import { getUser } from "@/lib/storage";
import { useMemo } from "react";
const tabs = [
{ to: "/", label: "Home", icon: Home },
{ to: "/scanner", label: "Scanner", icon: ScanLine },
{ to: "/lists", label: "Lists", icon: ListChecks },
{ to: "/profile", label: "Profile", icon: User },
];
export default function Layout() {
const user = useMemo(() => getUser(), []);
return (
<div className="mx-auto min-h-screen max-w-app pb-24">
<header className="sticky top-0 z-10 border-b border-slate-100 bg-white/80 px-4 py-3 backdrop-blur-md">
<div className="mx-auto flex max-w-3xl items-center justify-between">
<Link to="/" className="flex items-center gap-2">
<span className="rounded-full bg-gradient-to-br from-green-500 to-blue-500 p-2 text-white">
<Leaf size={18} />
</span>
<span className="text-lg font-semibold">HealthCart</span>
</Link>
<span className="rounded-full bg-slate-100 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-slate-600">
{user.subscription_tier}
</span>
</div>
</header>
<main className="mx-auto w-full max-w-3xl p-4">
<Outlet />
</main>
<nav className="fixed bottom-0 left-0 right-0 border-t border-slate-200 bg-white">
<div className="mx-auto grid max-w-3xl grid-cols-4">
{tabs.map(({ to, label, icon: Icon }) => (
<NavLink
key={to}
to={to}
className={({ isActive }) =>
`flex flex-col items-center gap-1 py-3 text-xs ${isActive ? "text-green-600" : "text-slate-500"}`
}
>
<Icon size={18} />
{label}
</NavLink>
))}
</div>
</nav>
</div>
);
}