Chore/theme setup env config (#1181)
* chore: fix /assets/env-config.js 404 by moving it to public dir * chore: set dark theme class before app load
This commit is contained in:
parent
02897f1ee1
commit
bab1bac2dc
@ -15,6 +15,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="./fonts.css">AlphaLyrae font</a></li>
|
<li><a href="./fonts.css">AlphaLyrae font</a></li>
|
||||||
<li><a href="./favicon.ico">Favicon</a></li>
|
<li><a href="./favicon.ico">Favicon</a></li>
|
||||||
|
<li><a href="./theme.js">Theme</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
9
apps/static/src/theme.js
Normal file
9
apps/static/src/theme.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
(function () {
|
||||||
|
var storedTheme = window.localStorage.getItem('theme');
|
||||||
|
if (
|
||||||
|
storedTheme === 'dark' ||
|
||||||
|
(!storedTheme && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||||
|
) {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
}
|
||||||
|
})();
|
@ -17,6 +17,11 @@ export default function Document() {
|
|||||||
href="https://static.vega.xyz/favicon.ico"
|
href="https://static.vega.xyz/favicon.ico"
|
||||||
/>
|
/>
|
||||||
<link rel="stylesheet" href="https://static.vega.xyz/fonts.css" />
|
<link rel="stylesheet" href="https://static.vega.xyz/fonts.css" />
|
||||||
|
<script
|
||||||
|
src="https://static.vega.xyz/theme.js"
|
||||||
|
type="text/javascript"
|
||||||
|
async
|
||||||
|
/>
|
||||||
{['1', 'true'].includes(process.env['NX_USE_ENV_OVERRIDES'] || '') ? (
|
{['1', 'true'].includes(process.env['NX_USE_ENV_OVERRIDES'] || '') ? (
|
||||||
/* eslint-disable-next-line @next/next/no-sync-scripts */
|
/* eslint-disable-next-line @next/next/no-sync-scripts */
|
||||||
<script src="/assets/env-config.js" type="text/javascript" />
|
<script src="/assets/env-config.js" type="text/javascript" />
|
||||||
|
Loading…
Reference in New Issue
Block a user