@premieroctet/next-admin
Version:
Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje
30 lines (29 loc) • 1.33 kB
JavaScript
"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { useEffect, useState } from "react";
import { useColorScheme } from "../context/ColorSchemeContext.mjs";
import { useI18n } from "../context/I18nContext.mjs";
const ColorSchemeSwitch = ()=>{
const { colorScheme, colorSchemeIcon, toggleColorScheme } = useColorScheme();
const { t } = useI18n();
const [isClient, setIsClient] = useState(false);
useEffect(()=>{
setIsClient(true);
}, []);
if (!isClient) return null;
return /*#__PURE__*/ jsxs("div", {
onClick: toggleColorScheme,
role: "button",
className: "text-nextadmin-menu-color dark:text-dark-nextadmin-menu-color hover:text-nextadmin-menu-emphasis dark:hover:text-dark-nextadmin-menu-emphasis hover:bg-nextadmin-menu-muted dark:hover:bg-dark-nextadmin-menu-muted flex cursor-pointer select-none flex-row items-center gap-5 rounded-lg p-3 text-sm font-medium transition-colors",
suppressHydrationWarning: true,
children: [
colorSchemeIcon,
/*#__PURE__*/ jsx("span", {
className: "min-w-[3.5rem]",
children: t(`theme.${colorScheme}`)
})
]
});
};
const components_ColorSchemeSwitch = ColorSchemeSwitch;
export { components_ColorSchemeSwitch as default };