Skip to content

Commit b2cebbd

Browse files
committed
chore(ui): update ThemeSwitch
1 parent c32f489 commit b2cebbd

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

apps/www/components/ThemeSwitch.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,28 @@
2222
* SOFTWARE.
2323
*/
2424

25-
import {cn} from '@/lib/utils';
2625
import {useTheme} from 'next-themes';
26+
import {ForwardedRef, forwardRef, ForwardRefExoticComponent, ReactElement, RefAttributes} from 'react';
27+
import {cn} from '@/lib/utils';
2728
import Button, {ButtonProps} from '@/components/Button';
2829
import {TestableComponent} from '@/types/dom';
29-
import {ForwardedRef, forwardRef, ForwardRefExoticComponent, PropsWithChildren, ReactElement} from 'react';
3030
import {Theme} from '@/types/theme';
3131
import MoonIcon from '@/icons/MoonIcon';
3232
import SunIcon from '@/icons/SunIcon';
3333

3434
/**
3535
* The `ThemeSwitchProps` interface represents the props accepted by the `ThemeSwitch` component.
3636
*/
37-
export type ThemeSwitchProps = ButtonProps &
38-
TestableComponent &
39-
PropsWithChildren<{
37+
export type ThemeSwitchProps = TestableComponent &
38+
ButtonProps & {
4039
/**
4140
* The variant of the theme switch component.
4241
* It can be either `'icon'` or `'labelled'`.
4342
*
4443
* @defaultValue `'icon'`
4544
*/
4645
variant?: 'icon' | 'labelled';
47-
}>;
46+
};
4847

4948
/**
5049
* `ThemeSwitch` is a React component that allows users to toggle between light and dark themes.
@@ -57,7 +56,10 @@ export type ThemeSwitchProps = ButtonProps &
5756
* @param props - Props for the component.
5857
* @returns ThemeSwitch as a React component.
5958
*/
60-
const ThemeSwitch: ForwardRefExoticComponent<ThemeSwitchProps> = forwardRef(
59+
const ThemeSwitch: ForwardRefExoticComponent<ThemeSwitchProps & RefAttributes<HTMLButtonElement>> = forwardRef<
60+
HTMLButtonElement,
61+
ThemeSwitchProps
62+
>(
6163
(
6264
{children, className, variant = 'icon', bordered, ...rest}: ThemeSwitchProps,
6365
ref: ForwardedRef<HTMLButtonElement>,

0 commit comments

Comments
 (0)