Skip to content

Commit

Permalink
Merge branch 'main' into external-links
Browse files Browse the repository at this point in the history
  • Loading branch information
thelegy authored Mar 1, 2024
2 parents 3c32aa9 + 562ce3e commit 7ac4f70
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
3 changes: 3 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function rehypeExternalLinksPlugin() {

// https://astro.build/config
export default defineConfig({
prefetch: {
prefetchAll: true,
},
integrations: [mdx(), tailwind(), compress()],
markdown: {
remarkPlugins: [setDefaultLayout],
Expand Down
69 changes: 34 additions & 35 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,44 @@ import ThemeToggle from '@components/ThemeToggle.astro'
<meta name="generator" content={Astro.generator} />
<title>KoMa - {title}</title>

<script is:inline>
{
const theme = localStorage.getItem('theme')
if (theme != null) {
document.documentElement.classList.remove('no-theme')
if (theme == 'dark') {
document.documentElement.classList.add('dark')
<body class="grid min-h-dvh grid-rows-[auto_1fr] bg-slate-100 dark:bg-slate-900">
<script is:inline>
{
const theme = localStorage.getItem('theme')
if (theme != null) {
document.documentElement.classList.remove('no-theme')
if (theme == 'dark') {
document.documentElement.classList.add('dark')
}
}
}
}
const toggleTheme = () => {
let currentDarkTheme
if (document.documentElement.classList.contains('no-theme')) {
currentDarkTheme = window.matchMedia('(prefers-color-scheme: dark').matches
document.documentElement.classList.remove('no-theme')
} else {
currentDarkTheme = document.documentElement.classList.contains('dark')
}
if (currentDarkTheme) {
document.documentElement.classList.remove('dark')
localStorage.setItem('theme', 'light')
} else {
document.documentElement.classList.add('dark')
localStorage.setItem('theme', 'dark')
document.documentElement.classList.remove('no-theme')
const toggleTheme = () => {
let currentDarkTheme
if (document.documentElement.classList.contains('no-theme')) {
currentDarkTheme = window.matchMedia('(prefers-color-scheme: dark').matches
document.documentElement.classList.remove('no-theme')
} else {
currentDarkTheme = document.documentElement.classList.contains('dark')
}
if (currentDarkTheme) {
document.documentElement.classList.remove('dark')
localStorage.setItem('theme', 'light')
} else {
document.documentElement.classList.add('dark')
localStorage.setItem('theme', 'dark')
document.documentElement.classList.remove('no-theme')
}
}
}
const toggleMenu = () => {
if (menu.dataset.menu == 'open') {
menu.dataset.menu = ''
menuToggle.ariaExpanded = 'false'
} else {
menu.dataset.menu = 'open'
menuToggle.ariaExpanded = 'true'
const toggleMenu = () => {
if (menu.dataset.menu == 'open') {
menu.dataset.menu = ''
menuToggle.ariaExpanded = 'false'
} else {
menu.dataset.menu = 'open'
menuToggle.ariaExpanded = 'true'
}
}
}
</script>

<body class="grid min-h-dvh grid-rows-[auto_1fr] bg-slate-100 dark:bg-slate-900">
</script>
<div class="fixed inset-x-0 z-30 h-14 print:hidden">
<header
class="flex h-fit border-t-8 border-teal-600 bg-gradient-to-tr from-slate-200 to-cyan-100 shadow shadow-slate-300 dark:from-slate-800 dark:to-cyan-900 dark:shadow-slate-900"
Expand Down

0 comments on commit 7ac4f70

Please sign in to comment.