Skip to content

Commit

Permalink
fix(theme-switch): highlight selected theme correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
R1shabh-Gupta committed Aug 20, 2024
1 parent 589faae commit 0ef9da6
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const ThemeRadioItem = ({ icon, ...props }: RadioProps & { icon: string }) => {
const groupContext = useRadioGroupContext();

const isSelected =
isSelfSelected ||
Number(groupContext.groupState.selectedValue) >= Number(props.value);
isSelfSelected || groupContext.groupState.selectedValue === props.value;

const wrapperProps = getWrapperProps();

Expand Down Expand Up @@ -55,7 +54,7 @@ const DashboardThemeSwitch = React.forwardRef<
HTMLDivElement,
Omit<RadioGroupProps, "children">
>(({ classNames = {}, ...props }, ref) => {
const { setTheme } = useTheme();
const { setTheme, theme } = useTheme();

return (
<RadioGroup
Expand All @@ -65,7 +64,7 @@ const DashboardThemeSwitch = React.forwardRef<
...classNames,
wrapper: cn("gap-0 items-center", classNames?.wrapper),
}}
defaultValue="dark"
defaultValue={theme}
orientation="horizontal"
{...props}
>
Expand Down

0 comments on commit 0ef9da6

Please sign in to comment.