diff --git a/src/client/theme-api/usePrefersColor.ts b/src/client/theme-api/usePrefersColor.ts index 11a2a30ba1..f24e8e8e57 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, + default: themeConfig.prefersColor?.default ?? 'auto', }); 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 8e159ef26a..9213306f02 100644 --- a/src/client/theme-default/slots/Content/index.less +++ b/src/client/theme-default/slots/Content/index.less @@ -206,4 +206,12 @@ 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 1126c03807..ea556c0454 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) => ( ))}