Skip to content

Commit c81d9d5

Browse files
committed
feat: add logout to the mobile nav
1 parent 4e961a7 commit c81d9d5

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

web/src/components/nav/header-mobile.tsx

+23-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { SideNavItem, SideNavItems } from "@/components/nav/constants";
33
import { cn } from "@/lib/utils";
44
import { motion, useCycle, Variants } from "framer-motion";
55
import { usePathname } from "next/navigation";
6-
import { ReactNode, useRef } from "react";
6+
import { ComponentProps, ReactNode, useRef } from "react";
77
import { useDimensions } from "@/hooks/use-dimensions";
88
import Link from "next/link";
9+
import { Button } from "@/components/ui/button";
10+
import { logOut } from "@/app/(auth)/action";
911

1012
const sidebarVariants: Variants = {
1113
open: (height: number = 1000) => ({
@@ -100,6 +102,23 @@ export function HeaderMobile() {
100102
</div>
101103
);
102104
})}
105+
<MenuItem className="flex w-full text-2xl my-3 cursor-pointer">
106+
<Link
107+
href={"https://github.com/listlessbird/sparkles/"}
108+
target="_blank"
109+
>
110+
github
111+
</Link>
112+
</MenuItem>
113+
114+
<MenuItem
115+
className="flex w-full text-2xl my-3 cursor-pointer"
116+
onClick={async () => {
117+
await logOut();
118+
}}
119+
>
120+
logout
121+
</MenuItem>
103122
</motion.ul>
104123
<MenuToggle toggle={toggleOpen} />
105124
</motion.nav>
@@ -109,12 +128,13 @@ export function HeaderMobile() {
109128
const MenuItem = ({
110129
className,
111130
children,
131+
...props
112132
}: {
113133
className?: string;
114134
children?: ReactNode;
115-
}) => {
135+
} & ComponentProps<typeof motion.li>) => {
116136
return (
117-
<motion.li variants={MenuItemVariants} className={className}>
137+
<motion.li variants={MenuItemVariants} className={className} {...props}>
118138
{children}
119139
</motion.li>
120140
);

0 commit comments

Comments
 (0)