Skip to content

Commit 9733bed

Browse files
committed
move ThemeScript inside head and solve white flash in Firefox
1 parent 60e16ae commit 9733bed

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

.github/workflows/bash__deploy-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflows:
66
- 'Build and push Docker'
77
types:
8-
- success
8+
- completed
99

1010
workflow_dispatch:
1111

docs/working-notes/todo3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,5 +503,7 @@ https://github.com/sindresorhus/github-markdown-css
503503
table of contents id links
504504
a href open in new tab
505505
fix links page links color for history back view transition
506+
507+
refactor theme script, osDefaultMode, appDefaultMode, storedMode
506508
------------
507509
```

src/components/BaseHead.astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import '@/styles/main.css';
44
55
import { ViewTransitions } from 'astro:transitions';
66
7+
import ThemeScript from '@/components/ThemeScript.astro';
78
import { DEFAULT_METADATA } from '@/constants/metadata';
89
import { ROUTES } from '@/constants/routes';
910
import { CONFIG } from '@/config';
@@ -41,6 +42,7 @@ const ogImageUrl = new URL(image, url);
4142
<meta charset="utf-8" />
4243
<meta name="viewport" content="width=device-width,initial-scale=1" />
4344

45+
{/* wrong, set from theme toggle */}
4446
<meta name="theme-color" content="#c1ddf9" media="(prefers-color-scheme: light)" />
4547
<meta name="theme-color" content="#0f172a" media="(prefers-color-scheme: dark)" />
4648

@@ -108,6 +110,8 @@ const ogImageUrl = new URL(image, url);
108110
<script src="set-url-here" crossorigin="anonymous"></script>
109111
-->
110112

113+
<ThemeScript />
114+
111115
<ViewTransitions fallback="none" />
112116

113117
<!--

src/layouts/Base.astro

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import BaseHead from '@/components/BaseHead.astro';
55
import Footer from '@/components/Footer.astro';
66
import Header from '@/components/Header.astro';
77
import ScrollToTop from '@/components/react/ScrollToTop';
8-
import ThemeScript from '@/components/ThemeScript.astro';
98
109
import type { BaseHeadProps } from '@/components/BaseHead.astro';
1110
@@ -24,7 +23,5 @@ const { metadata } = Astro.props as BaseProps;
2423
<ScrollToTop client:only="react">
2524
<Icon name="mdi:arrow-up-thin" class="h-10 w-10 text-content hover:text-links-hover" />
2625
</ScrollToTop>
27-
28-
<ThemeScript />
2926
</body>
3027
</html>

0 commit comments

Comments
 (0)