// This implementation is derived from the solution provided by [shadcn] in shadcn/ui // https://github.com/shadcn-ui/ui "use client"; import * as React from "react"; import { useTheme } from "next-themes"; import { Sun, Moon } from "lucide-react"; import { Button } from "@/components/ui/button"; export function ModeSwitcher() { const { setTheme, resolvedTheme } = useTheme(); const toggleTheme = React.useCallback(() => { setTheme(resolvedTheme === "dark" ? "light" : "dark"); }, [resolvedTheme, setTheme]); return ( ); }