mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-24 00:15:17 -05:00
docs: fix nav layout
This commit is contained in:
@@ -29,7 +29,6 @@ export default function Layout({ children }: { children: ReactNode }) {
|
||||
>
|
||||
<RootProvider>
|
||||
<NavbarProvider>
|
||||
<BetaNotice />
|
||||
<Navbar />
|
||||
{children}
|
||||
</NavbarProvider>
|
||||
|
||||
+27
-27
@@ -1,39 +1,39 @@
|
||||
import React from "react";
|
||||
import Link from "next/link";
|
||||
import { ThemeToggle } from "@/components/theme-toggler";
|
||||
import Image from "next/image";
|
||||
import { NavbarMobileBtn } from "./nav-mobile";
|
||||
import { NavbarMobile, NavbarMobileBtn } from "./nav-mobile";
|
||||
import { NavLink } from "./nav-link";
|
||||
import { Logo } from "./logo";
|
||||
import { PulicBetaBadge } from "./beta/badge";
|
||||
import { useState } from "react";
|
||||
import { MenuIcon, X } from "lucide-react";
|
||||
|
||||
export const Navbar = () => {
|
||||
return (
|
||||
<nav className="sticky z-40 top-0 flex items-center justify-between bg-background backdrop-blur-md">
|
||||
<Link
|
||||
href="/"
|
||||
className="md:border-r md:px-5 px-2.5 py-4 text-foreground md:col-span-2 shrink-0 transition-colors md:w-[--fd-sidebar-width]"
|
||||
>
|
||||
<div className="flex flex-col gap-2 w-full">
|
||||
<div className="flex items-center gap-2">
|
||||
<Logo />
|
||||
<p>BETTER-AUTH.</p>
|
||||
<div className="flex flex-col sticky top-0 bg-background backdrop-blur-md z-30">
|
||||
<nav className="md:grid grid-cols-12 md:border-b top-0 flex items-center justify-between ">
|
||||
<Link
|
||||
href="/"
|
||||
className="md:border-r md:px-5 px-2.5 py-4 text-foreground md:col-span-2 shrink-0 transition-colors md:w-[--fd-sidebar-width]"
|
||||
>
|
||||
<div className="flex flex-col gap-2 w-full">
|
||||
<div className="flex items-center gap-2">
|
||||
<Logo />
|
||||
<p>BETTER-AUTH.</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<div className="md:col-span-10 flex items-center justify-end relative">
|
||||
<ul className="md:flex items-center divide-x w-max border-r hidden shrink-0">
|
||||
{navMenu.map((menu, i) => (
|
||||
<NavLink key={menu.name} href={menu.path}>
|
||||
{menu.name}
|
||||
</NavLink>
|
||||
))}
|
||||
</ul>
|
||||
<ThemeToggle />
|
||||
<NavbarMobileBtn />
|
||||
</div>
|
||||
</Link>
|
||||
<div className="md:col-span-10 flex items-center justify-end sticky top-0 z-30 pb-3 w-full font-geist border-b border-black/10 transition duration-200 ease-in-out md:bg-transparent animate-header-slide-down-fade dark:border-white/10 md:backdrop-blur-md">
|
||||
<ul className="md:flex items-center divide-x w-max border-r hidden shrink-0">
|
||||
{navMenu.map((menu, i) => (
|
||||
<NavLink key={menu.name} href={menu.path}>
|
||||
{menu.name}
|
||||
</NavLink>
|
||||
))}
|
||||
</ul>
|
||||
<ThemeToggle />
|
||||
<NavbarMobileBtn />
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
<NavbarMobile />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ export const NavbarMobileBtn: React.FC = () => {
|
||||
const { toggleNavbar } = useNavbarMobile();
|
||||
|
||||
return (
|
||||
<div className="flex pt-2 items-center">
|
||||
<div className="flex pt-2 items-center ">
|
||||
<MobileThemeToggle />
|
||||
<button
|
||||
className="text-muted-foreground overflow-hidden px-2.5 block md:hidden"
|
||||
className="text-muted-foreground overflow-hidden px-2.5 block md:hidden"
|
||||
onClick={() => {
|
||||
toggleNavbar();
|
||||
}}
|
||||
|
||||
@@ -53,26 +53,25 @@ export function ThemeToggle() {
|
||||
export function MobileThemeToggle() {
|
||||
const { theme, setTheme } = useTheme();
|
||||
return (
|
||||
<div className="">
|
||||
{theme === "dark" ? (
|
||||
<Button
|
||||
onClick={() => {
|
||||
setTheme("light");
|
||||
}}
|
||||
variant={"ghost"}
|
||||
>
|
||||
<Sun className="w-4 h-4" />
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
onClick={() => {
|
||||
setTheme("dark");
|
||||
}}
|
||||
variant={"ghost"}
|
||||
>
|
||||
<MoonIcon className="w-4 h-4" />
|
||||
</Button>
|
||||
)}
|
||||
<div className="md:hidden">
|
||||
<Button
|
||||
className="dark:hidden"
|
||||
onClick={() => {
|
||||
setTheme("light");
|
||||
}}
|
||||
variant={"ghost"}
|
||||
>
|
||||
<Sun className="w-4 h-4" />
|
||||
</Button>
|
||||
<Button
|
||||
className="hidden dark:visible"
|
||||
onClick={() => {
|
||||
setTheme("dark");
|
||||
}}
|
||||
variant={"ghost"}
|
||||
>
|
||||
<MoonIcon className="w-4 h-4" />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { createAuthEndpoint } from "../call";
|
||||
import { deleteSessionCookie } from "../../utils/cookies";
|
||||
import { APIError } from "better-call";
|
||||
|
||||
export const signOut = createAuthEndpoint(
|
||||
"/sign-out",
|
||||
@@ -18,7 +19,9 @@ export const signOut = createAuthEndpoint(
|
||||
ctx.context.secret,
|
||||
);
|
||||
if (!sessionCookieToken) {
|
||||
return ctx.json(null);
|
||||
throw new APIError("BAD_REQUEST", {
|
||||
message: "Session not found",
|
||||
});
|
||||
}
|
||||
await ctx.context.internalAdapter.deleteSession(sessionCookieToken);
|
||||
deleteSessionCookie(ctx);
|
||||
|
||||
Reference in New Issue
Block a user