wip(Front dark mode)
This commit is contained in:
@@ -33,6 +33,7 @@ import { dashboard } from '@/routes';
|
|||||||
import { type BreadcrumbItem, type NavItem, type SharedData } from '@/types';
|
import { type BreadcrumbItem, type NavItem, type SharedData } from '@/types';
|
||||||
import { Link, usePage } from '@inertiajs/react';
|
import { Link, usePage } from '@inertiajs/react';
|
||||||
import { BookOpen, Folder, LayoutGrid, Menu, Search } from 'lucide-react';
|
import { BookOpen, Folder, LayoutGrid, Menu, Search } from 'lucide-react';
|
||||||
|
import AppearanceToggleDropdown from './appearance-dropdown';
|
||||||
import AppLogo from './app-logo';
|
import AppLogo from './app-logo';
|
||||||
import AppLogoIcon from './app-logo-icon';
|
import AppLogoIcon from './app-logo-icon';
|
||||||
|
|
||||||
@@ -238,6 +239,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<AppearanceToggleDropdown />
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {Button} from "@/components/ui/button";
|
|||||||
import type {SharedData} from "@/types";
|
import type {SharedData} from "@/types";
|
||||||
import {useMobileNavigation} from "@/hooks/use-mobile-navigation";
|
import {useMobileNavigation} from "@/hooks/use-mobile-navigation";
|
||||||
import {LogOut} from "lucide-react";
|
import {LogOut} from "lucide-react";
|
||||||
|
import React, {useEffect, useState} from "react";
|
||||||
|
|
||||||
export default function NavGuestLayout() {
|
export default function NavGuestLayout() {
|
||||||
const {auth} = usePage<SharedData>().props;
|
const {auth} = usePage<SharedData>().props;
|
||||||
@@ -15,6 +16,16 @@ export default function NavGuestLayout() {
|
|||||||
router.flushAll();
|
router.flushAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [dark, setDark] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (dark) {
|
||||||
|
document.documentElement.classList.add("dark");
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove("dark");
|
||||||
|
}
|
||||||
|
}, [dark]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<header
|
<header
|
||||||
@@ -90,6 +101,12 @@ export default function NavGuestLayout() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</nav>
|
</nav>
|
||||||
|
<button
|
||||||
|
onClick={() => setDark(!dark)}
|
||||||
|
className="absolute top-4 right-4 px-3 py-1 rounded-xl border border-gray-400 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800 transition"
|
||||||
|
>
|
||||||
|
{dark ? "☀️ Mode clair" : "🌙 Mode sombre"}
|
||||||
|
</button>
|
||||||
</header>
|
</header>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user