Skip to content

Commit

Permalink
feat(docs): 🎸 兼容深色模式
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyling committed May 27, 2024
1 parent 0c5d027 commit 6873541
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
14 changes: 0 additions & 14 deletions .dumi/app.tsx

This file was deleted.

6 changes: 5 additions & 1 deletion .dumi/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ body {
padding: 0 !important;
background-color: #eceef1;

@{dark-selector} & {
background-color: #1b1b1b;
}

// &::-webkit-scrollbar {
// width: 0px;
// }
Expand All @@ -107,4 +111,4 @@ body {
.home-expo {
max-width: 1000px;
margin: 0 auto;
}
}
19 changes: 19 additions & 0 deletions .dumi/theme/layouts/GlobalLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Provider, Theme } from '@fruits-chain/react-native-xiaoshu'
import { useOutlet, usePrefersColor } from 'dumi'
import React from 'react'

const GlobalLayout: React.FC<React.PropsWithChildren> = ({ children }) => {
const outlet = useOutlet()
// color 为当前应用的主题色,dark or light
const [color] = usePrefersColor()

console.log('isDark => ', color)

return (
<Provider theme={color === 'dark' ? Theme.dark : undefined}>
{outlet}
</Provider>
)
}

export default GlobalLayout

0 comments on commit 6873541

Please sign in to comment.