Simplify theme setting in root
This commit is contained in:
parent
2fc6a521c3
commit
13b02c39a0
12
app/root.tsx
12
app/root.tsx
@ -165,14 +165,18 @@ function getMarkup(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<html
|
<html
|
||||||
|
data-theme={loaderData.theme}
|
||||||
lang="en-US"
|
lang="en-US"
|
||||||
{...(loaderData.theme && {
|
|
||||||
"data-theme": loaderData.theme,
|
|
||||||
style: { colorScheme: loaderData.theme },
|
|
||||||
})}
|
|
||||||
>
|
>
|
||||||
<head>
|
<head>
|
||||||
<Links />
|
<Links />
|
||||||
|
<style nonce={loaderData.nonce}>
|
||||||
|
{`
|
||||||
|
:root {
|
||||||
|
color-scheme: ${loaderData.theme};
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
{serverStyleData?.map(({ key, ids, css }) => (
|
{serverStyleData?.map(({ key, ids, css }) => (
|
||||||
<style
|
<style
|
||||||
key={key}
|
key={key}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user