first commit

This commit is contained in:
Matt Kane
2026-04-01 10:44:22 +01:00
commit 43fcb9a131
1789 changed files with 395041 additions and 0 deletions

View File

@@ -0,0 +1,455 @@
---
import { getMenu, getSiteSettings } from "emdash";
import { EmDashHead } from "emdash/ui";
import { createPublicPageContext } from "emdash/page";
interface Props {
title?: string;
description?: string;
image?: string;
type?: "website" | "article";
}
const { title, description, image, type = "website" } = Astro.props;
const settings = await getSiteSettings();
const siteTitle = settings?.title || "Studio";
const fullTitle = title ? `${title} — ${siteTitle}` : siteTitle;
const siteDescription = settings?.tagline || "Design & Development";
const menu = await getMenu("primary");
const pageCtx = createPublicPageContext({
Astro,
kind: "custom",
pageType: type,
title: fullTitle,
description: description || siteDescription,
canonical: Astro.url.href,
image,
seo: { ogImage: image },
siteName: siteTitle,
});
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{fullTitle}</title>
<EmDashHead page={pageCtx} />
<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=Playfair+Display:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
rel="alternate"
type="application/rss+xml"
title={`${siteTitle} RSS Feed`}
href="/rss.xml"
/>
<script is:inline>
// Apply theme immediately to prevent flash
(function () {
var c = document.cookie;
var i = c.indexOf("theme=");
var theme = i >= 0 ? c.slice(i + 6).split(";")[0] : null;
if (theme === "dark" || theme === "light") {
document.documentElement.classList.add(theme);
} else if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
document.documentElement.classList.add("dark");
}
})();
</script>
</head>
<body>
<header class="site-header">
<nav class="nav">
<a href="/" class="site-title">{siteTitle}</a>
<div class="nav-links">
{
menu?.items.map((item) => (
<a href={item.url} target={item.target}>
{item.label}
</a>
))
}
<a href="/_emdash/admin" class="nav-admin">Admin</a>
</div>
</nav>
</header>
<main>
<slot />
</main>
<footer class="site-footer">
<div class="footer-content">
<div class="footer-brand">
<span class="footer-logo">{siteTitle}</span>
<p class="footer-tagline">
{settings?.tagline || "Design & Development"}
</p>
</div>
<div class="footer-right">
<div class="theme-switcher">
<button
type="button"
class="theme-btn"
data-theme="light"
aria-label="Light mode">Light</button
>
<button
type="button"
class="theme-btn"
data-theme="dark"
aria-label="Dark mode">Dark</button
>
<button
type="button"
class="theme-btn"
data-theme="system"
aria-label="System theme">System</button
>
</div>
<p class="footer-powered">
Powered by <a href="https://emdashcms.com">EmDash</a>
</p>
</div>
</div>
</footer>
<script>
// Theme switcher
const THEME_REGEX = /theme=([^;]+)/;
const themeBtns =
document.querySelectorAll<HTMLButtonElement>(".theme-btn");
const root = document.documentElement;
function setTheme(theme: string) {
const secure = location.protocol === "https:" ? "; Secure" : "";
if (theme === "system") {
document.cookie = `theme=; path=/; max-age=0; SameSite=Lax${secure}`;
root.classList.remove("light", "dark");
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
root.classList.add("dark");
}
} else {
document.cookie = `theme=${theme}; path=/; max-age=31536000; SameSite=Lax${secure}`;
root.classList.remove("light", "dark");
root.classList.add(theme);
}
updateActiveBtn(theme);
}
function updateActiveBtn(theme: string) {
themeBtns.forEach((btn) => {
btn.classList.toggle("active", btn.dataset.theme === theme);
});
}
function getStoredTheme(): string {
const match = document.cookie.match(THEME_REGEX);
return match ? match[1] : "system";
}
// Initialize - apply stored theme on load
const storedTheme = getStoredTheme();
setTheme(storedTheme);
themeBtns.forEach((btn) => {
btn.addEventListener("click", () => {
setTheme(btn.dataset.theme || "system");
});
});
// Listen for system preference changes
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", (e) => {
if (getStoredTheme() === "system") {
root.classList.toggle("dark", e.matches);
}
});
</script>
<style is:global>
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
/* Colors - Elegant/Minimal palette */
--color-bg: #fafafa;
--color-text: #1a1a1a;
--color-muted: #6b7280;
--color-border: #e5e7eb;
--color-surface: #ffffff;
--color-accent: #7c3aed;
--color-accent-muted: #a78bfa;
/* Typography */
--font-serif: "Playfair Display", Georgia, serif;
--font-sans: system-ui, -apple-system, sans-serif;
--font-mono: ui-monospace, monospace;
--font-size-sm: 0.875rem;
--font-size-base: 1.0625rem;
--font-size-lg: 1.25rem;
--font-size-xl: 1.5rem;
--font-size-2xl: 2rem;
--font-size-3xl: 2.75rem;
--font-size-4xl: 3.5rem;
/* Spacing */
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--spacing-2xl: 3rem;
--spacing-3xl: 4rem;
--spacing-4xl: 6rem;
/* Layout */
--max-width: 720px;
--wide-width: 1200px;
--radius: 4px;
/* Transitions */
--transition-fast: 150ms ease;
--transition-base: 200ms ease;
--transition-slow: 300ms ease;
}
/* Dark mode via system preference (when no explicit class) */
@media (prefers-color-scheme: dark) {
:root:not(.light) {
--color-bg: #0a0a0a;
--color-text: #f5f5f5;
--color-muted: #a1a1aa;
--color-border: #27272a;
--color-surface: #18181b;
--color-accent: #a78bfa;
--color-accent-muted: #7c3aed;
}
}
/* Explicit dark mode */
:root.dark {
--color-bg: #0a0a0a;
--color-text: #f5f5f5;
--color-muted: #a1a1aa;
--color-border: #27272a;
--color-surface: #18181b;
--color-accent: #a78bfa;
--color-accent-muted: #7c3aed;
}
html {
scroll-behavior: smooth;
}
body {
font-family: var(--font-sans);
font-size: var(--font-size-base);
line-height: 1.6;
color: var(--color-text);
background: var(--color-bg);
-webkit-font-smoothing: antialiased;
min-height: 100vh;
}
a {
color: currentColor;
}
img {
max-width: 100%;
height: auto;
display: block;
}
h1,
h2,
h3,
h4 {
font-family: var(--font-serif);
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: var(--font-size-4xl);
}
h2 {
font-size: var(--font-size-2xl);
}
h3 {
font-size: var(--font-size-xl);
}
</style>
<style>
.site-header {
max-width: var(--wide-width);
margin: 0 auto;
padding: var(--spacing-xl) var(--spacing-lg);
}
.nav {
display: flex;
justify-content: space-between;
align-items: center;
}
.site-title {
font-family: var(--font-serif);
font-size: var(--font-size-lg);
font-weight: 600;
text-decoration: none;
letter-spacing: -0.02em;
}
.nav-links {
display: flex;
gap: var(--spacing-xl);
font-size: var(--font-size-sm);
}
.nav-links a {
text-decoration: none;
color: var(--color-muted);
transition: color var(--transition-fast);
}
.nav-links a:hover {
color: var(--color-text);
}
.nav-links a:empty {
display: none;
}
.nav-admin {
opacity: 0.5;
}
main {
min-height: calc(100vh - 200px);
}
.site-footer {
max-width: var(--wide-width);
margin: 0 auto;
padding: var(--spacing-3xl) var(--spacing-lg);
border-top: 1px solid var(--color-border);
}
.footer-content {
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.footer-logo {
font-family: var(--font-serif);
font-size: var(--font-size-lg);
font-weight: 600;
}
.footer-tagline {
font-family: var(--font-serif);
font-style: italic;
font-size: var(--font-size-sm);
color: var(--color-muted);
margin-top: var(--spacing-xs);
}
.footer-right {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: var(--spacing-md);
}
.theme-switcher {
display: flex;
gap: var(--spacing-xs);
}
.theme-btn {
background: transparent;
border: 1px solid var(--color-border);
color: var(--color-muted);
font-family: var(--font-sans);
font-size: var(--font-size-sm);
padding: var(--spacing-xs) var(--spacing-sm);
border-radius: var(--radius);
cursor: pointer;
transition: all var(--transition-fast);
}
.theme-btn:hover {
color: var(--color-text);
border-color: var(--color-text);
}
.theme-btn.active {
background: var(--color-surface);
color: var(--color-text);
border-color: var(--color-accent);
}
.footer-powered {
font-size: var(--font-size-sm);
color: var(--color-muted);
}
.footer-powered a {
color: var(--color-text);
text-decoration: none;
}
.footer-powered a:hover {
text-decoration: underline;
}
@media (max-width: 640px) {
.nav {
flex-direction: column;
gap: var(--spacing-md);
align-items: center;
}
.nav-links {
flex-wrap: wrap;
justify-content: center;
}
.footer-content {
flex-direction: column;
gap: var(--spacing-xl);
align-items: center;
text-align: center;
}
.footer-right {
align-items: center;
}
h1 {
font-size: var(--font-size-3xl);
}
}
</style>
</body>
</html>