[web] Add themed project loading screen GitOrigin-RevId: b73d8c825b5ab04ede1c9dde10a6891be63758a4
13 lines
438 B
TypeScript
13 lines
438 B
TypeScript
import { useLayoutEffect } from 'react'
|
|
import { useActiveOverallTheme } from './use-active-overall-theme'
|
|
|
|
export default function useThemedPage(featureFlag?: string) {
|
|
const activeOverallTheme = useActiveOverallTheme(featureFlag)
|
|
|
|
useLayoutEffect(() => {
|
|
// Sets the body's data-theme attribute for theming
|
|
document.body.dataset.theme =
|
|
activeOverallTheme === 'dark' ? 'default' : 'light'
|
|
}, [activeOverallTheme])
|
|
}
|