diff --git a/src/client/theme-api/usePrefersColor.ts b/src/client/theme-api/usePrefersColor.ts index f24e8e8e57..11a2a30ba1 100644 --- a/src/client/theme-api/usePrefersColor.ts +++ b/src/client/theme-api/usePrefersColor.ts @@ -86,7 +86,7 @@ class ColorChanger { * listen color change * @param cb callback */ - listen(cb: typeof this.callbacks[number]) { + listen(cb: (typeof this.callbacks)[number]) { this.callbacks.push(cb); } @@ -94,7 +94,7 @@ class ColorChanger { * unlisten color change * @param cb callback */ - unlisten(cb: typeof this.callbacks[number]) { + unlisten(cb: (typeof this.callbacks)[number]) { this.callbacks.splice(this.callbacks.indexOf(cb), 1); } @@ -137,7 +137,7 @@ export const usePrefersColor = () => { useEffect(() => { // lazy initialize, for SSR colorChanger ??= new ColorChanger({ - default: themeConfig.prefersColor?.default ?? 'auto', + default: themeConfig.prefersColor.default, }); colorChanger.listen(colorChangeHandler); setColor(colorChanger.color); diff --git a/src/client/theme-default/slots/Content/index.less b/src/client/theme-default/slots/Content/index.less index 9213306f02..8e159ef26a 100644 --- a/src/client/theme-default/slots/Content/index.less +++ b/src/client/theme-default/slots/Content/index.less @@ -206,12 +206,4 @@ margin-bottom: 24px; } } - - &[data-no-sidebar][data-no-footer] { - margin-bottom: @s-content-padding; - - @media @mobile { - margin-bottom: 24px; - } - } } diff --git a/src/client/theme-default/slots/Header/index.tsx b/src/client/theme-default/slots/Header/index.tsx index ea556c0454..1126c03807 100644 --- a/src/client/theme-default/slots/Header/index.tsx +++ b/src/client/theme-default/slots/Header/index.tsx @@ -48,7 +48,7 @@ const Header: FC = () => { - {themeConfig.prefersColor?.switch && } + {themeConfig.prefersColor.switch && } {socialIcons.map((item) => ( ))}