diff --git a/public/assets/js/detect-theme.min.js b/public/assets/js/detect-theme.min.js new file mode 100644 index 0000000..767e086 --- /dev/null +++ b/public/assets/js/detect-theme.min.js @@ -0,0 +1 @@ +window.theme=(()=>{const e=localStorage.getItem("theme");if(e&&("dark"===e||"light"===e))return e;const t=window.matchMedia("(prefers-color-scheme: dark)").matches;return t?"dark":"light"})(),document.documentElement.setAttribute("data-theme",window.theme),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:e})=>{window.theme=e?"dark":"light",localStorage.setItem("theme",window.theme),document.documentElement.setAttribute("data-theme",window.theme)}); \ No newline at end of file diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 842e33b..9038dc1 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -21,5 +21,5 @@ - + \ No newline at end of file diff --git a/src/components/Header/Header.astro b/src/components/Header/Header.astro index 13c833b..520bd36 100644 --- a/src/components/Header/Header.astro +++ b/src/components/Header/Header.astro @@ -1,12 +1,13 @@ --- -import './Header.scss'; -import { SITE_METADATA } from '@root/config'; -import ThemeSwitcher from '@components/ThemeSwticher'; -import { Icon } from 'astro-icon'; -import NavToggle from './NavToggle'; + import './Header.scss'; + import { SITE_METADATA } from '@root/config'; + import ThemeSwitcher from '@components/ThemeSwticher'; + import { Icon } from 'astro-icon'; + import { removeSlashes } from '@utils/string' + import NavToggle from './NavToggle'; -const { name, nav, contacts } = SITE_METADATA; -const { pathname } = Astro.canonicalURL; + const { name, nav, contacts } = SITE_METADATA; + const { pathname } = Astro.canonicalURL; --- @@ -17,11 +18,11 @@ const { pathname } = Astro.canonicalURL; {nav.map((link) => ( - - - {link.name} - - + + + {link.name} + + ))} @@ -42,4 +43,4 @@ const { pathname } = Astro.canonicalURL; - + \ No newline at end of file diff --git a/src/pages/404.astro b/src/pages/404.astro new file mode 100644 index 0000000..d12a21c --- /dev/null +++ b/src/pages/404.astro @@ -0,0 +1,10 @@ +--- + import PageLayout from '@layouts/default.astro' +--- + + + + 404 + Страницу которую вы пытаетесь найти не существует. + + \ No newline at end of file diff --git a/src/utils/string.ts b/src/utils/string.ts new file mode 100644 index 0000000..23d213a --- /dev/null +++ b/src/utils/string.ts @@ -0,0 +1,3 @@ +export function removeSlashes(string: string): string { + return string.replaceAll('/', ''); +}
Страницу которую вы пытаетесь найти не существует.