diff --git a/src/lib/components/DarkThemeToggle/index.tsx b/src/lib/components/DarkThemeToggle/index.tsx index 40dae3fd0..71a59d6cb 100644 --- a/src/lib/components/DarkThemeToggle/index.tsx +++ b/src/lib/components/DarkThemeToggle/index.tsx @@ -1,23 +1,29 @@ -import type { FC } from 'react'; +import type { ComponentProps, FC } from 'react'; import { useContext } from 'react'; import { HiMoon, HiSun } from 'react-icons/hi'; -import { ThemeContext } from '../Flowbite/ThemeContext'; +import { excludeClassName } from '../../helpers/exclude'; +import { ThemeContext, useTheme } from '../Flowbite/ThemeContext'; -export const DarkThemeToggle: FC = () => { +export type DarkThemeToggleProps = Omit, 'className'>; + +export const DarkThemeToggle: FC = (props) => { + const theirProps = excludeClassName(props); + const theme = useTheme().theme.darkThemeToggle; const { mode, toggleMode } = useContext(ThemeContext); return ( ); diff --git a/src/lib/components/Flowbite/FlowbiteTheme.ts b/src/lib/components/Flowbite/FlowbiteTheme.ts index 4ea4a49ef..208b52234 100644 --- a/src/lib/components/Flowbite/FlowbiteTheme.ts +++ b/src/lib/components/Flowbite/FlowbiteTheme.ts @@ -143,6 +143,10 @@ export interface FlowbiteTheme { snap: string; }; }; + darkThemeToggle: { + base: string; + icon: string; + }; modal: { base: string; show: FlowbiteBoolean; diff --git a/src/lib/theme/default.ts b/src/lib/theme/default.ts index f6021388b..8d700570c 100644 --- a/src/lib/theme/default.ts +++ b/src/lib/theme/default.ts @@ -259,6 +259,10 @@ export default { snap: 'snap-x', }, }, + darkThemeToggle: { + base: 'rounded-lg p-2.5 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-700', + icon: 'h-5 w-5', + }, modal: { base: 'fixed top-0 right-0 left-0 z-50 h-modal overflow-y-auto overflow-x-hidden md:inset-0 md:h-full', show: {