Skip to content

Commit

Permalink
fix applyDarkStyles
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Jan 26, 2024
1 parent c361a6e commit 65002fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 7 additions & 3 deletions apps/zero-runtime-next-app/src/augment.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type { experimental_extendTheme } from '@mui/material/styles';
import type { Theme } from '@mui/material/styles';
import type {} from '@mui/material/themeCssVarsAugmentation';
import '@mui/zero-runtime/theme';

declare module '@mui/zero-runtime/theme' {
export interface ThemeArgs {
theme: ReturnType<typeof experimental_extendTheme> & {
applyDarkStyles<T>(obj: T): Record<string, T>;
theme: Omit<Theme, 'applyStyles'> & {
applyStyles: (
colorScheme: 'light' | 'dark',
styles: Record<string, any>,
) => Record<string, any>;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const SliderTrack = styled('span', {
},
style: {
'--slider-track-color': lightPrimaryColor,
...theme.applyDarkStyles({
...theme.applyStyles('dark', {
'--slider-track-color': darkPrimaryColor,
}),
},
Expand All @@ -242,7 +242,7 @@ const SliderTrack = styled('span', {
},
style: {
'--slider-track-color': lightSecondaryColor,
...theme.applyDarkStyles({
...theme.applyStyles('dark', {
'--slider-track-color': darkSecondaryColor,
}),
},
Expand Down Expand Up @@ -686,7 +686,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr

const ownerState: SliderOwnerState = {
...props,
// @ts-expect-error @TODO - Figure out how to support rtl/ltr with themes
isRtl,
max,
min,
Expand Down Expand Up @@ -761,7 +760,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
},
ownerState: {
...ownerState,
// @ts-expect-error
...rootSlotProps?.ownerState,
},
className: [classes.root, className],
Expand All @@ -785,7 +783,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
},
ownerState: {
...ownerState,
// @ts-expect-error
...trackSlotProps?.ownerState,
},
className: classes.track,
Expand All @@ -797,7 +794,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
externalSlotProps: thumbSlotProps,
ownerState: {
...ownerState,
// @ts-expect-error
...thumbSlotProps?.ownerState,
},
className: classes.thumb,
Expand All @@ -808,7 +804,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
externalSlotProps: valueLabelSlotProps,
ownerState: {
...ownerState,
// @ts-expect-error
...valueLabelSlotProps?.ownerState,
},
className: classes.valueLabel,
Expand Down

0 comments on commit 65002fc

Please sign in to comment.