cloudflare/kumo
Publicmirrored fromhttps://github.com/cloudflare/kumoAvailable
packages/kumo-docs-astro/src/layouts/BaseLayout.astro
59lines · modecode
| 1 | --- |
| 2 | import "../styles/global.css"; |
| 3 | |
| 4 | interface Props { |
| 5 | title?: string; |
| 6 | description?: string; |
| 7 | } |
| 8 | |
| 9 | const { title = "Kumo", description = "Kumo – a modern component library" } = |
| 10 | Astro.props; |
| 11 | |
| 12 | // Build info is injected via Vite define in astro.config.mjs |
| 13 | // These are replaced at build time with actual values |
| 14 | declare const __KUMO_VERSION__: string; |
| 15 | declare const __DOCS_VERSION__: string; |
| 16 | declare const __BUILD_COMMIT__: string; |
| 17 | declare const __BUILD_DATE__: string; |
| 18 | |
| 19 | const kumoVersion = typeof __KUMO_VERSION__ !== "undefined" ? __KUMO_VERSION__ : "dev"; |
| 20 | const docsVersion = typeof __DOCS_VERSION__ !== "undefined" ? __DOCS_VERSION__ : "dev"; |
| 21 | const buildCommit = typeof __BUILD_COMMIT__ !== "undefined" ? __BUILD_COMMIT__ : "local"; |
| 22 | const buildDate = typeof __BUILD_DATE__ !== "undefined" ? __BUILD_DATE__ : new Date().toISOString(); |
| 23 | --- |
| 24 | |
| 25 | <!doctype html> |
| 26 | <html class="bg-kumo-elevated" lang="en"> |
| 27 | <head> |
| 28 | <meta charset="utf-8" /> |
| 29 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 30 | <meta name="kumo-version" content={kumoVersion} /> |
| 31 | <meta name="docs-version" content={docsVersion} /> |
| 32 | <meta name="build-commit" content={buildCommit} /> |
| 33 | <meta name="build-date" content={buildDate} /> |
| 34 | <title>{title}</title> |
| 35 | <meta name="description" content={description} /> |
| 36 | <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> |
| 37 | <link rel="preconnect" href="https://fonts.googleapis.com" /> |
| 38 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
| 39 | <link |
| 40 | rel="stylesheet" |
| 41 | href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=optional" |
| 42 | /> |
| 43 | <script is:inline> |
| 44 | // Initialize theme from localStorage or system preference |
| 45 | // This runs immediately (blocking) to prevent flash of unstyled content |
| 46 | (function() { |
| 47 | const stored = localStorage.getItem("theme"); |
| 48 | if (stored) { |
| 49 | document.documentElement.setAttribute("data-mode", stored); |
| 50 | } else if (window.matchMedia("(prefers-color-scheme: dark)").matches) { |
| 51 | document.documentElement.setAttribute("data-mode", "dark"); |
| 52 | } |
| 53 | })(); |
| 54 | </script> |
| 55 | </head> |
| 56 | <body> |
| 57 | <slot /> |
| 58 | </body> |
| 59 | </html> |
| 60 | |