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:
@@ -15,6 +15,7 @@
|
||||
<ul>
|
||||
<li><a href="./fonts.css">AlphaLyrae font</a></li>
|
||||
<li><a href="./favicon.ico">Favicon</a></li>
|
||||
<li><a href="./theme.js">Theme</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
<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'] || '') ? (
|
||||
/* eslint-disable-next-line @next/next/no-sync-scripts */
|
||||
<script src="/assets/env-config.js" type="text/javascript" />
|
||||
|
||||
Reference in New Issue
Block a user