File tree 2 files changed +52
-42
lines changed
2 files changed +52
-42
lines changed Original file line number Diff line number Diff line change @@ -94,26 +94,30 @@ export function DsfrHead(props: DsfrHeadProps) {
94
94
< link rel = "shortcut icon" href = { getAssetUrl ( FaviconIco ) } type = "image/x-icon" />
95
95
</ >
96
96
) }
97
- < script
98
- suppressHydrationWarning
99
- nonce = { nonce }
100
- dangerouslySetInnerHTML = { {
101
- "__html" : getScriptToRunAsap ( {
102
- defaultColorScheme,
103
- nonce,
104
- trustedTypesPolicyName
105
- } )
106
- } }
107
- />
108
- { nonce !== undefined && (
109
- < script
110
- suppressHydrationWarning
111
- key = "nonce-setter"
112
- nonce = { nonce }
113
- dangerouslySetInnerHTML = { {
114
- __html : `window.ssrNonce = "${ nonce } ";`
115
- } }
116
- />
97
+ { defaultColorScheme !== "light" && (
98
+ < >
99
+ < script
100
+ suppressHydrationWarning
101
+ nonce = { nonce }
102
+ dangerouslySetInnerHTML = { {
103
+ "__html" : getScriptToRunAsap ( {
104
+ defaultColorScheme,
105
+ nonce,
106
+ trustedTypesPolicyName
107
+ } )
108
+ } }
109
+ />
110
+ { nonce !== undefined && (
111
+ < script
112
+ suppressHydrationWarning
113
+ key = "nonce-setter"
114
+ nonce = { nonce }
115
+ dangerouslySetInnerHTML = { {
116
+ __html : `window.ssrNonce = "${ nonce } ";`
117
+ } }
118
+ />
119
+ ) }
120
+ </ >
117
121
) }
118
122
</ >
119
123
) ;
Original file line number Diff line number Diff line change @@ -199,31 +199,37 @@ export function createNextDsfrIntegrationApi(
199
199
/>
200
200
</ >
201
201
) }
202
- { ! isBrowser && ( //NOTE: On browser we handle this manually
202
+ { defaultColorScheme !== "light" && (
203
203
< >
204
- < style id = { rootColorSchemeStyleTagId } > { `:root { color-scheme: ${
205
- isDark ? "dark" : "light"
206
- } ; }`} </ style >
207
- < meta
208
- name = "theme-color"
209
- content = {
210
- fr . colors . getHex ( { isDark } ) . decisions . background . default
211
- . grey . default
212
- }
213
- />
204
+ { ! isBrowser && ( //NOTE: On browser we handle this manually
205
+ < >
206
+ < style
207
+ id = { rootColorSchemeStyleTagId }
208
+ > { `:root { color-scheme: ${
209
+ isDark ? "dark" : "light"
210
+ } ; }`} </ style >
211
+ < meta
212
+ name = "theme-color"
213
+ content = {
214
+ fr . colors . getHex ( { isDark } ) . decisions . background
215
+ . default . grey . default
216
+ }
217
+ />
218
+ </ >
219
+ ) }
220
+ { isProduction && ! isBrowser && (
221
+ < script
222
+ dangerouslySetInnerHTML = { {
223
+ "__html" : getScriptToRunAsap ( {
224
+ defaultColorScheme,
225
+ trustedTypesPolicyName,
226
+ "nonce" : undefined
227
+ } )
228
+ } }
229
+ />
230
+ ) }
214
231
</ >
215
232
) }
216
- { isProduction && ! isBrowser && (
217
- < script
218
- dangerouslySetInnerHTML = { {
219
- "__html" : getScriptToRunAsap ( {
220
- defaultColorScheme,
221
- trustedTypesPolicyName,
222
- "nonce" : undefined
223
- } )
224
- } }
225
- />
226
- ) }
227
233
</ Head >
228
234
{ isBrowser ? (
229
235
< App { ...( props as any ) } />
You can’t perform that action at this time.
0 commit comments