Skip to content

Commit

Permalink
Revert "chore: revert change"
Browse files Browse the repository at this point in the history
This reverts commit 6eeac57.
  • Loading branch information
Wxh16144 committed Dec 15, 2023
1 parent 6eeac57 commit fee192f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/client/theme-api/usePrefersColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ class ColorChanger {
* listen color change
* @param cb callback
*/
listen(cb: (typeof this.callbacks)[number]) {
listen(cb: typeof this.callbacks[number]) {
this.callbacks.push(cb);
}

/**
* 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);
}

Expand Down Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions src/client/theme-default/slots/Content/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,12 @@
margin-bottom: 24px;
}
}

&[data-no-sidebar][data-no-footer] {
margin-bottom: @s-content-padding;

@media @mobile {
margin-bottom: 24px;
}
}
}
2 changes: 1 addition & 1 deletion src/client/theme-default/slots/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Header: FC = () => {
<SearchBar />
<LangSwitch />
<RtlSwitch />
{themeConfig.prefersColor.switch && <ColorSwitch />}
{themeConfig.prefersColor?.switch && <ColorSwitch />}
{socialIcons.map((item) => (
<SocialIcon icon={item.icon} link={item.link} key={item.link} />
))}
Expand Down

0 comments on commit fee192f

Please sign in to comment.