Update import paths for Lang type across layout files to use new location Add umami analytics script in production mode
94 lines
2.7 KiB
Plaintext
94 lines
2.7 KiB
Plaintext
---
|
|
import { useTranslations } from "@/i18n/utils";
|
|
import type { Lang } from "@/types/i18n";
|
|
import { defaultLang } from "@/i18n/ui";
|
|
import "../styles/global.css";
|
|
|
|
interface Props {
|
|
title?: string;
|
|
description?: string;
|
|
}
|
|
|
|
const lang = Astro.currentLocale as Lang || defaultLang;
|
|
const { title = "Rishikesh S - Portfolio", description = "My Portfolio" } =
|
|
Astro.props;
|
|
const t = useTranslations(lang);
|
|
---
|
|
|
|
<!doctype html>
|
|
<html lang={lang}>
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width" />
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
<meta name="generator" content={Astro.generator} />
|
|
<meta name="description" content={description} />
|
|
<title>{title}{t('site.title') ? ` | ${t('site.title')}` : ''}</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
{
|
|
import.meta.env.MODE === 'production' && (
|
|
<script defer src="https://cloud.umami.is/script.js" data-website-id="a79f759b-74ae-4165-b738-56d123a1c6be"></script>
|
|
)
|
|
}
|
|
</head>
|
|
<body
|
|
class="min-h-screen bg-background font-sans antialiased selection:bg-purple-500/20 selection:text-purple-500"
|
|
>
|
|
<div
|
|
class="fixed inset-0 -z-10 h-full w-full bg-background bg-[radial-gradient(ellipse_80%_80%_at_50%_-20%,rgba(120,119,198,0.3),rgba(255,255,255,0))]"
|
|
>
|
|
</div>
|
|
<slot />
|
|
</body>
|
|
</html>
|
|
|
|
<script is:inline>
|
|
const getThemePreference = () => {
|
|
if (typeof localStorage !== "undefined" && localStorage.getItem("theme")) {
|
|
return localStorage.getItem("theme");
|
|
}
|
|
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
? "dark"
|
|
: "light";
|
|
};
|
|
const isDark = getThemePreference() === "dark";
|
|
document.documentElement.classList[isDark ? "add" : "remove"]("dark");
|
|
|
|
if (typeof localStorage !== "undefined") {
|
|
const observer = new MutationObserver(() => {
|
|
const isDark = document.documentElement.classList.contains("dark");
|
|
localStorage.setItem("theme", isDark ? "dark" : "light");
|
|
});
|
|
observer.observe(document.documentElement, {
|
|
attributes: true,
|
|
attributeFilter: ["class"],
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
scroll-behavior: smooth;
|
|
}
|
|
|
|
:root {
|
|
--transition-standard: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
body {
|
|
transition:
|
|
background-color var(--transition-standard),
|
|
color var(--transition-standard);
|
|
}
|
|
</style>
|