Skip to content

Commit

Permalink
i18n(zh-cn): Update 6-islands/2.mdx (withastro#10590)
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <[email protected]>
  • Loading branch information
Nin3lee and sarah11918 authored Jan 3, 2025
1 parent 9d40f8a commit 0d23265
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/content/docs/zh-cn/tutorial/6-islands/2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ import { Steps } from '@astrojs/starlight/components';
<script is:inline>
const theme = (() => {
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
return localStorage.getItem('theme');
return localStorage.getItem('theme') ?? "light";
}
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
return 'dark';
Expand All @@ -131,7 +131,7 @@ import { Steps } from '@astrojs/starlight/components';
localStorage.setItem("theme", isDark ? "dark" : "light");
}
document.getElementById("themeToggle").addEventListener("click", handleToggleClick);
document.getElementById("themeToggle")?.addEventListener("click", handleToggleClick);
</script>
```

Expand Down

0 comments on commit 0d23265

Please sign in to comment.