Files
Frost/examples/index.html
T

105 lines
5.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Frost v0.4 example</title>
<link rel="stylesheet" href="../frost.css">
<style>
body { padding-block: var(--frost-space-8); }
.example-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--frost-space-4); margin-block-end: var(--frost-space-8); }
.example-header h1 { margin-block-end: var(--frost-space-2); }
.example-section { margin-block-start: var(--frost-space-8); }
.example-section > h2 { margin-block-end: var(--frost-space-4); }
.example-sidebar { padding: var(--frost-space-4); background: var(--frost-color-surface-soft); border-inline-end: 1px solid var(--frost-color-border); }
.example-sidebar a { display: block; padding: var(--frost-space-2); }
.swatch { min-height: 4rem; padding: var(--frost-space-3); border-radius: var(--frost-radius-md); background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
</style>
</head>
<body>
<a class="frost-skip-link" href="#main">Skip to content</a>
<main id="main" class="frost-container">
<header class="example-header">
<div>
<p class="frost-text-muted">Frost CSS framework</p>
<h1>Small foundations for cold starts.</h1>
</div>
<button class="frost-button frost-button--secondary" id="theme-toggle" type="button">Toggle theme</button>
</header>
<section class="frost-notice frost-notice--info" aria-label="Framework note">
Frost is CSS-only. This page uses a tiny script only to demonstrate explicit theme switching.
</section>
<section class="example-section frost-stack">
<h2>Tokens and surfaces</h2>
<div class="frost-grid" style="--frost-grid-min: 12rem">
<div class="swatch">Accent</div>
<div class="frost-card frost-card--flat">Flat card</div>
<div class="frost-card frost-card--elevated">Elevated card</div>
</div>
</section>
<section class="example-section frost-stack">
<h2>Feedback and menus</h2>
<div class="frost-alert frost-alert--warning" role="alert">
<strong class="frost-alert__title">Heads up</strong>
<span class="frost-alert__body">This is a dismissible-style alert primitive; your behavior layer controls dismissal.</span>
</div>
<div class="frost-cluster">
<div class="frost-dropdown">
<button class="frost-button frost-button--secondary" id="menu-trigger" type="button" aria-expanded="false" aria-controls="example-menu">Open menu</button>
<div class="frost-dropdown__menu" id="example-menu" hidden>
<a class="frost-dropdown__item" href="#main">Overview</a>
<button class="frost-dropdown__item" type="button">A menu action</button>
</div>
</div>
<button class="frost-button frost-button--primary frost-tooltip" data-frost-tooltip="A CSS-only tooltip" aria-label="Tooltip demo">Hover or focus</button>
</div>
<div class="frost-toast frost-toast--success" role="status"><span>Changes saved successfully.</span><button class="frost-button frost-button--icon" type="button" aria-label="Dismiss example toast">×</button></div>
</section>
<section class="example-section frost-stack">
<h2>Buttons and badges</h2>
<div class="frost-row">
<button class="frost-button frost-button--primary">Primary</button>
<button class="frost-button frost-button--secondary">Secondary</button>
<button class="frost-button frost-button--ghost">Ghost</button>
<button class="frost-button frost-button--danger">Danger</button>
<button class="frost-button frost-button--secondary" disabled>Disabled</button>
<span class="frost-badge frost-badge--success">Success</span>
<span class="frost-badge frost-badge--warning">Warning</span>
</div>
</section>
<section class="example-section frost-grid" style="--frost-grid-min: 18rem">
<div class="frost-card">
<h2>Form controls</h2>
<form class="frost-stack" style="--frost-stack-gap: var(--frost-space-4)">
<label class="frost-field"><span class="frost-label">Name</span><input class="frost-input" type="text" placeholder="Ada Lovelace"></label>
<label class="frost-field"><span class="frost-label">Type</span><select class="frost-select"><option>Website</option><option>Application</option></select></label>
<label class="frost-field"><span class="frost-label">Message</span><textarea class="frost-textarea" placeholder="Write something..."></textarea></label>
<button class="frost-button frost-button--primary" type="submit">Submit</button>
</form>
</div>
<div id="controls" class="frost-sidebar-layout">
<aside class="frost-sidebar example-sidebar"><strong>Sidebar</strong><a href="#main">Overview</a><a href="#controls">Controls</a></aside>
<div class="frost-main frost-card frost-card--flat"><h2>Sidebar layout</h2><p class="frost-text-muted">The layout becomes a normal single column below 48rem.</p></div>
</div>
</section>
</main>
<script>
document.querySelector('#theme-toggle').addEventListener('click', () => {
document.documentElement.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
});
document.querySelector('#menu-trigger').addEventListener('click', (event) => {
const trigger = event.currentTarget;
const menu = document.querySelector('#example-menu');
const open = trigger.getAttribute('aria-expanded') === 'true';
trigger.setAttribute('aria-expanded', String(!open));
menu.hidden = open;
});
</script>
</body>
</html>