Skip to content

Commit 5328215

Browse files
jeremymanningclaude
andcommitted
style(demos): Complete Eliza-style theming for demos 2-5
Apply consistent styling patterns from demo-01-eliza: Demo 02 (Tokenization): - CSS variables for hardcoded colors - Hero-header styling consistency Demo 03 (Embeddings): - Major CSS overhaul with CSS variables - Hero-header styling consistency Demo 04 (Attention): - Hero-header styling consistency Demo 05 (Transformer): - CSS variables for hardcoded colors - Hero-header styling consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 485a727 commit 5328215

File tree

7 files changed

+407
-250
lines changed

7 files changed

+407
-250
lines changed

demos/02-tokenization/css/tokenization.css

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
/* Global Styles - Uses CSS variables from ../shared/css/demo-styles.css for theming */
2-
* {
3-
margin: 0;
4-
padding: 0;
5-
box-sizing: border-box;
6-
}
1+
/**
2+
* Interactive Tokenization Visualizer - Styles
3+
* Uses CSS variables from ../shared/css/demo-styles.css for theming
4+
*/
75

86
/* Demo-specific variables that don't conflict with theming */
97
:root {
108
--token-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
119
--token-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
1210
--token-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
11+
--token-transition: all 0.3s ease;
12+
--primary-hover: #4f46e5;
1313
--radius-sm: 4px;
1414
--radius-md: 8px;
1515
--radius-lg: 12px;
@@ -21,53 +21,59 @@
2121
padding: 20px;
2222
}
2323

24-
/* Header */
25-
header {
24+
/* Hero Header - matches ELIZA demo styling */
25+
.hero-header {
26+
padding: 3rem 0 2rem;
27+
margin-bottom: 30px;
2628
text-align: center;
27-
margin-bottom: 40px;
28-
padding: 40px 20px;
29-
background: var(--gradient-primary);
30-
color: white;
31-
border-radius: var(--radius-lg);
32-
box-shadow: var(--token-shadow-lg);
29+
background: linear-gradient(180deg, var(--surface-color) 0%, var(--bg-color) 100%);
3330
}
3431

35-
header h1 {
36-
font-size: 2.5rem;
37-
margin-bottom: 10px;
38-
font-weight: 700;
32+
.hero-title {
33+
font-size: clamp(2rem, 4vw, 3rem);
34+
font-weight: 800;
35+
margin-bottom: 1rem;
36+
background: var(--gradient-primary);
37+
-webkit-background-clip: text;
38+
background-clip: text;
39+
-webkit-text-fill-color: transparent;
3940
}
4041

41-
.subtitle {
42-
font-size: 1.1rem;
43-
opacity: 0.9;
42+
.hero-subtitle {
43+
font-size: clamp(1rem, 2vw, 1.25rem);
44+
color: var(--text-secondary);
45+
max-width: 600px;
46+
margin: 0 auto;
4447
}
4548

46-
/* Tabs */
49+
/* Tabs - matches ELIZA demo styling */
4750
.tabs {
4851
display: flex;
4952
gap: 10px;
50-
margin-bottom: 30px;
53+
margin-bottom: 20px;
5154
border-bottom: 2px solid var(--border-color);
55+
background: var(--surface-color);
56+
padding: 10px 20px 0;
57+
border-radius: 8px 8px 0 0;
58+
box-shadow: var(--token-shadow-md);
5259
flex-wrap: wrap;
5360
}
5461

5562
.tab-button {
5663
padding: 12px 24px;
57-
background: none;
64+
background: transparent;
5865
border: none;
5966
border-bottom: 3px solid transparent;
6067
color: var(--text-secondary);
6168
font-size: 1rem;
6269
font-weight: 500;
6370
cursor: pointer;
64-
transition: all 0.3s;
65-
position: relative;
66-
bottom: -2px;
71+
transition: var(--token-transition);
6772
}
6873

6974
.tab-button:hover {
7075
color: var(--primary-color);
76+
background: var(--surface-hover);
7177
}
7278

7379
.tab-button.active {
@@ -77,25 +83,29 @@ header h1 {
7783

7884
.tab-content {
7985
display: none;
80-
animation: fadeIn 0.3s;
86+
background: var(--surface-color);
87+
padding: 30px;
88+
border-radius: 0 0 8px 8px;
89+
box-shadow: var(--token-shadow-md);
90+
min-height: 600px;
8191
}
8292

8393
.tab-content.active {
8494
display: block;
95+
animation: fadeIn 0.3s ease-in;
8596
}
8697

8798
@keyframes fadeIn {
8899
from { opacity: 0; transform: translateY(10px); }
89100
to { opacity: 1; transform: translateY(0); }
90101
}
91102

92-
/* Input Section */
103+
/* Input Section - matches ELIZA demo styling */
93104
.input-section {
94-
background: var(--surface-color);
95-
padding: 30px;
96-
border-radius: var(--radius-lg);
97-
box-shadow: var(--token-shadow-md);
98-
margin-bottom: 30px;
105+
background: var(--bg-secondary);
106+
padding: 20px;
107+
border-radius: var(--radius-md);
108+
margin-bottom: 20px;
99109
}
100110

101111
.input-section label {
@@ -108,21 +118,22 @@ header h1 {
108118
.input-section textarea,
109119
.input-section input[type="text"] {
110120
width: 100%;
111-
padding: 12px;
121+
padding: 12px 18px;
112122
border: 2px solid var(--border-color);
113-
border-radius: var(--radius-md);
123+
border-radius: 8px;
114124
font-size: 1rem;
115125
font-family: inherit;
116-
transition: border-color 0.3s;
126+
transition: var(--token-transition);
117127
resize: vertical;
118128
background: var(--surface-color);
119129
color: var(--text-primary);
130+
outline: none;
120131
}
121132

122133
.input-section textarea:focus,
123134
.input-section input[type="text"]:focus {
124-
outline: none;
125135
border-color: var(--primary-color);
136+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
126137
}
127138

128139
.controls {
@@ -133,16 +144,16 @@ header h1 {
133144
flex-wrap: wrap;
134145
}
135146

136-
/* Buttons */
147+
/* Buttons - matches ELIZA demo styling */
137148
.primary-btn,
138149
.secondary-btn {
139-
padding: 10px 20px;
150+
padding: 12px 24px;
140151
border: none;
141-
border-radius: var(--radius-md);
152+
border-radius: 24px;
142153
font-size: 1rem;
143154
font-weight: 500;
144155
cursor: pointer;
145-
transition: all 0.3s;
156+
transition: var(--token-transition);
146157
}
147158

148159
.primary-btn {
@@ -152,18 +163,17 @@ header h1 {
152163

153164
.primary-btn:hover:not(:disabled) {
154165
background: var(--primary-hover);
155-
transform: translateY(-1px);
166+
transform: translateY(-2px);
156167
box-shadow: var(--token-shadow-md);
157168
}
158169

159170
.secondary-btn {
160-
background: var(--surface-color);
161-
color: var(--text-primary);
162-
border: 2px solid var(--border-color);
171+
background: var(--text-secondary);
172+
color: white;
163173
}
164174

165175
.secondary-btn:hover:not(:disabled) {
166-
background: var(--surface-hover);
176+
opacity: 0.9;
167177
}
168178

169179
button:disabled {

demos/02-tokenization/index.html

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
</head>
1111
<body>
1212
<nav class="demo-nav">
13-
<a href="../" class="back-link">← Back to Demos</a>
14-
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">☀️</button>
13+
<a href="../" class="back-link">← Home</a>
14+
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
15+
<span id="theme-icon">&#127769;</span>
16+
</button>
1517
</nav>
18+
<div class="hero-header">
19+
<div class="container">
20+
<h1 class="hero-title">Interactive Tokenization Visualizer</h1>
21+
<p class="hero-subtitle">Explore how different tokenization algorithms break down text</p>
22+
</div>
23+
</div>
1624
<div class="container">
17-
<header>
18-
<h1>Interactive Tokenization Visualizer</h1>
19-
<p class="subtitle">Explore how different tokenization algorithms break down text</p>
20-
</header>
2125

2226
<div class="tabs">
2327
<button class="tab-button active" data-tab="comparison">Tokenizer Comparison</button>
@@ -249,15 +253,21 @@ <h4>Subword Tokens</h4>
249253
<script type="module" src="js/bpe-visualizer.js"></script>
250254

251255
<script>
252-
// Theme toggle functionality
256+
// Theme toggle functionality (synced with main index via localStorage)
253257
const themeToggle = document.getElementById('theme-toggle');
258+
const themeIcon = document.getElementById('theme-icon');
254259
const html = document.documentElement;
255260

256-
// Load saved theme
261+
// Load saved theme from localStorage
257262
const savedTheme = localStorage.getItem('theme') || 'dark';
258263
html.setAttribute('data-theme', savedTheme);
259-
if (themeToggle) {
260-
themeToggle.textContent = savedTheme === 'dark' ? '☀️' : '🌙';
264+
updateThemeIcon(savedTheme);
265+
266+
function updateThemeIcon(theme) {
267+
// Using the same icons as main index.html (moon/sun HTML entities)
268+
if (themeIcon) {
269+
themeIcon.textContent = theme === 'dark' ? '\u{1F319}' : '\u2600\uFE0F';
270+
}
261271
}
262272

263273
if (themeToggle) {
@@ -266,7 +276,7 @@ <h4>Subword Tokens</h4>
266276
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
267277
html.setAttribute('data-theme', newTheme);
268278
localStorage.setItem('theme', newTheme);
269-
themeToggle.textContent = newTheme === 'dark' ? '☀️' : '🌙';
279+
updateThemeIcon(newTheme);
270280
});
271281
}
272282
</script>

0 commit comments

Comments
 (0)