Skip to content

Commit

Permalink
Force light theme to avoid issues (specially for devs)
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Sep 9, 2024
1 parent 36ac277 commit 9cf5634
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/layout/Default.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Box, BoxProps, Grid } from '@chakra-ui/react'
import { Box, BoxProps, Grid, useColorMode } from '@chakra-ui/react'
import { useEffect } from 'react'
import { Outlet, ScrollRestoration } from 'react-router-dom'
import { Footer } from '~components/Layout/Footer'
import { TopBar } from '~components/Layout/TopBar'
Expand All @@ -19,6 +20,7 @@ const DefaultLayout = (props: BoxProps) => (
const Layout = () => (
<Box minH='100vh' display='flex' flexDirection='column'>
<ScrollRestoration />
<ForceLightTheme />
<Grid p={{ base: 0, md: 3 }}>
<TopBar />
<DefaultLayout>
Expand All @@ -29,4 +31,15 @@ const Layout = () => (
</Box>
)

// We need to force the theme to light to avoid issues switching from the
// composer layout (auto) to the default one (light)
const ForceLightTheme = () => {
const { setColorMode } = useColorMode()
useEffect(() => {
setColorMode('light')
}, [])

return null
}

export default Layout

2 comments on commit 9cf5634

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.