feat(navbar): add modular navbar components and color variables
This commit is contained in:
parent
6dbc16f23d
commit
6c4ef371c1
7 changed files with 154 additions and 48 deletions
26
apps/web/src/components/navbar/NavLogout.tsx
Normal file
26
apps/web/src/components/navbar/NavLogout.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { signOut } from "../../lib/auth-client";
|
||||
|
||||
type NavLogoutProps = { name: string };
|
||||
|
||||
const NavLogout = ({ name }: NavLogoutProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleLogout = () => {
|
||||
void signOut()
|
||||
.then(() => void navigate({ to: "/" }))
|
||||
.catch((err) => console.error("logout error:", err));
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={handleLogout}
|
||||
className="text-sm text-(--color-text-muted) transition-colors duration-200
|
||||
hover:text-(--color-primary)"
|
||||
>
|
||||
logout <span className="text-(--color-accent)">{name}</span>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export default NavLogout;
|
||||
Loading…
Add table
Add a link
Reference in a new issue