-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo-components.html
More file actions
162 lines (157 loc) · 7.78 KB
/
Copy pathdemo-components.html
File metadata and controls
162 lines (157 loc) · 7.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Components Demo</title>
<link rel="stylesheet" href="../index.css">
<style>
.demo-section { margin-bottom: 2rem; padding: 1rem; border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); }
.component-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.component-example { padding: 1rem; border-radius: var(--radius-md); border: 1px solid var(--outline-default); }
#theme-toggle { margin-bottom: 1rem; background: var(--accent); color: var(--text-on-accent); border: none; padding: 0.5rem 1rem; border-radius: var(--radius-md); cursor: pointer; }
/* Dark mode styles */
html[data-theme="dark"] {
--accent-l: 70%; --accent-c: 0.18;
--surface-c: 0.02; --l-threshold: 0.6;
--base: oklch(var(--base-l, 22%) calc(var(--surface-c) * 0.9) var(--neutral-h));
--bedrock: oklch(95% calc(var(--surface-c) * 0.7) var(--neutral-h));
--surface-muted: oklch(20% calc(var(--surface-c) * 0.5) var(--neutral-h));
--surface-subtle: oklch(21% calc(var(--surface-c) * 0.7) var(--neutral-h));
--surface-default: oklch(25% var(--surface-c) var(--neutral-h));
--surface-overt: oklch(30% calc(var(--surface-c) * 1.2) var(--neutral-h));
--text-muted: oklch(65% calc(var(--surface-c) * 1.2) var(--neutral-h) / 0.8);
--text-subtle: oklch(75% calc(var(--surface-c) * 1.0) var(--neutral-h));
--text-default: oklch(88% calc(var(--surface-c) * 0.8) var(--neutral-h));
--text-overt: oklch(95% calc(var(--surface-c) * 0.6) var(--neutral-h));
--outline-subtle: oklch(from var(--base) calc(l + var(--l-delta-5)) c h);
--outline-default: oklch(from var(--base) calc(l + var(--l-delta-6)) calc(c + var(--c-delta-1)) h);
--outline-overt: oklch(from var(--base) calc(l + var(--l-delta-7)) calc(c + var(--c-delta-2)) h);
--highlight-bg-muted: oklch(from var(--base) calc(l + var(--l-delta-1)) c h);
--highlight-bg-subtle: oklch(from var(--base) calc(l + var(--l-delta-3)) c h);
--success-l: 65%; --warning-l: 75%; --error-l: 70%; --info-l: 75%;
--success: oklch(var(--success-l) var(--success-c) var(--success-h));
--warning: oklch(var(--warning-l) var(--warning-c) var(--warning-h));
--error: oklch(var(--error-l) var(--error-c) var(--error-h));
--info: oklch(var(--info-l) var(--info-c) var(--info-h));
--text-success: var(--success); --text-warning: var(--warning); --text-error: var(--error); --text-info: var(--info);
}
</style>
</head>
<body>
<div class="container">
<h1>Components Demo</h1>
<button onclick="toggleTheme()" id="theme-toggle">Switch to Dark Mode</button>
<!-- Forms Section -->
<section class="demo-section">
<h2>Forms</h2>
<p>Form elements using theme variables.</p>
<div class="component-grid">
<div class="component-example">
<h3>Basic Form</h3>
<form>
<label for="name">Name:</label>
<form-input><input type="text" id="name" placeholder="Enter your name"></form-input>
<label for="email">Email:</label>
<form-input><input type="email" id="email" placeholder="Enter your email"></form-input>
<label for="message">Message:</label>
<form-textarea><textarea id="message" placeholder="Enter your message"></textarea></form-textarea>
<form-button><button type="submit">Submit</button></form-button>
</form>
</div>
<div class="component-example">
<h3>Button Variants</h3>
<form-button><button class="btn-primary">Primary</button></form-button>
<form-button><button class="btn-secondary">Secondary</button></form-button>
<form-button><button class="btn-success">Success</button></form-button>
<form-button><button class="btn-warning">Warning</button></form-button>
<form-button><button class="btn-error">Error</button></form-button>
</div>
</div>
</section>
<!-- Cards Section -->
<section class="demo-section">
<h2>Cards</h2>
<p>Card components with responsive layouts.</p>
<div class="component-grid">
<card>
<card-media><img src="https://via.placeholder.com/400x225" alt="Placeholder"></card-media>
<card-body>
<card-header>Card Title</card-header>
<card-content>This is the card content. It adapts its layout based on the card's width.</card-content>
<card-footer>Card Footer</card-footer>
</card-body>
</card>
<card>
<card-body>
<card-header>Text Only Card</card-header>
<card-content>This card has no media, just text content.</card-content>
<card-footer>Footer info</card-footer>
</card-body>
</card>
</div>
</section>
<!-- Navigation Section -->
<section class="demo-section">
<h2>Navigation</h2>
<p>Navbar and sidebar navigation components.</p>
<nav-navbar>
<a href="#" class="nav-brand">Brand</a>
<ul class="nav-links">
<li><a href="#" class="nav-link">Home</a></li>
<li><a href="#" class="nav-link nav-link-active">About</a></li>
<li><a href="#" class="nav-link">Services</a></li>
<li><a href="#" class="nav-link">Contact</a></li>
</ul>
<button class="nav-toggle">☰</button>
</nav-navbar>
<div style="display: flex; margin-top: 2rem;">
<nav-sidebar>
<ul class="sidebar-nav">
<li class="sidebar-section">Main</li>
<li><a href="#" class="sidebar-link">Dashboard</a></li>
<li><a href="#" class="sidebar-link sidebar-link-active">Projects</a></li>
<li class="sidebar-section">Account</li>
<li><a href="#" class="sidebar-link">Settings</a></li>
<li><a href="#" class="sidebar-link">Logout</a></li>
</ul>
</nav-sidebar>
<div style="flex: 1; padding: 1rem;">
<h3>Main Content</h3>
<p>This is the main content area next to the sidebar.</p>
</div>
</div>
</section>
<!-- Other Components -->
<section class="demo-section">
<h2>Other Components</h2>
<p>Additional component examples.</p>
<div class="component-grid">
<div class="component-example">
<h3>Alerts</h3>
<div style="background: var(--success); color: var(--text-on-success); padding: 1rem; border-radius: var(--radius-md);">Success Alert</div>
<div style="background: var(--warning); color: var(--text-on-warning); padding: 1rem; border-radius: var(--radius-md);">Warning Alert</div>
<div style="background: var(--error); color: var(--text-on-error); padding: 1rem; border-radius: var(--radius-md);">Error Alert</div>
</div>
<div class="component-example">
<h3>Badges</h3>
<span style="background: var(--accent); color: var(--text-on-accent); padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.75rem;">New</span>
<span style="background: var(--secondary); color: var(--text-on-secondary); padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.75rem;">Beta</span>
</div>
</div>
</section>
</div>
<script>
function toggleTheme() {
const html = document.documentElement;
if (html.getAttribute('data-theme') === 'dark') {
html.removeAttribute('data-theme');
document.getElementById('theme-toggle').textContent = 'Switch to Dark Mode';
} else {
html.setAttribute('data-theme', 'dark');
document.getElementById('theme-toggle').textContent = 'Switch to Light Mode';
}
}
</script>
</body>
</html>