Skip to content

Commit a1cb8f8

Browse files
staredclaude
andcommitted
Simplify editor toolbar to minimal design
Remove unnecessary features and simplify toolbar to match Tufte-style minimalist design philosophy. Changes: - Remove "New equation mode" button and functionality - Remove "Download" button - Replace "Contribute" button with direct GitHub repo link - Move "View source" link from title bar to editor toolbar - Remove all borders/frames from toolbar buttons - Use simple text links with subtle underlines on hover - Cleaner toolbar with just toggle + two links UI improvements: - No title bar in main content (just h1 directly) - Toolbar background matches sidebar (#f9fafb) - Toggle button with no border, opacity hover effect - Consistent minimal styling throughout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ac25a19 commit a1cb8f8

File tree

3 files changed

+33
-137
lines changed

3 files changed

+33
-137
lines changed

index.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ <h2>Equations</h2>
1414
</aside>
1515

1616
<main id="main-content" class="main-content">
17-
<div class="title-bar">
18-
<h1 id="equation-title">Interactive Equations</h1>
19-
<a id="source-link" class="source-link" href="#" target="_blank" rel="noopener">View source</a>
20-
</div>
17+
<h1 id="equation-title">Interactive Equations</h1>
2118
<p class="subtitle">Hover over colored terms to explore their meaning</p>
2219

2320
<div id="color-scheme-switcher" class="color-scheme-switcher"></div>
@@ -45,9 +42,8 @@ <h1 id="equation-title">Interactive Equations</h1>
4542
<button id="toggle-editor-btn" class="toolbar-btn" title="Show/hide editor">
4643
<span class="icon"></span>
4744
</button>
48-
<button id="new-equation-btn" class="toolbar-btn" title="Create new equation">New</button>
49-
<button id="download-btn" class="toolbar-btn" title="Download markdown">Download</button>
50-
<button id="contribute-btn" class="toolbar-btn" title="Contribute to repository">Contribute</button>
45+
<a id="source-link" class="toolbar-link" href="#" target="_blank" rel="noopener">View source</a>
46+
<a href="https://github.com/stared/equations-explained-colorfully" class="toolbar-link" target="_blank" rel="noopener">Contribute</a>
5147
</div>
5248
<div id="editor-container" class="editor-container"></div>
5349
</aside>

src/main.ts

Lines changed: 2 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ let parsedContent: ParsedContent | null = null;
7171

7272
// Editor state
7373
let editor: any = null;
74-
let isNewEquationMode = false;
7574
let currentMarkdown = '';
7675
let previewTimeout: number | null = null;
7776

@@ -263,10 +262,8 @@ async function loadEquation(equationId: string, updateHash = true) {
263262
});
264263
}
265264

266-
// Load markdown into editor (for existing equation mode)
267-
if (!isNewEquationMode) {
268-
await loadMarkdownIntoEditor(`./examples/${equation.file}`);
269-
}
265+
// Load markdown into editor
266+
await loadMarkdownIntoEditor(`./examples/${equation.file}`);
270267
}
271268

272269
// Create equation selector buttons
@@ -410,97 +407,6 @@ function setupEditorControls() {
410407
editorSidebar.classList.toggle('collapsed');
411408
});
412409
}
413-
414-
// New equation mode toggle
415-
const newEquationBtn = document.getElementById('new-equation-btn');
416-
if (newEquationBtn && editorSidebar) {
417-
newEquationBtn.addEventListener('click', () => {
418-
isNewEquationMode = !isNewEquationMode;
419-
420-
if (isNewEquationMode) {
421-
// Switch to new mode: show editor, load template
422-
editorSidebar.classList.remove('collapsed');
423-
newEquationBtn.textContent = 'Exit New Mode';
424-
425-
// Load template
426-
const template = `# Equation
427-
428-
$$
429-
\\mark[term1]{E} = \\mark[term2]{m} \\mark[term3]{c^2}
430-
$$
431-
432-
# Description
433-
434-
The famous [mass-energy equivalence]{.term2}: [energy]{.term1} equals [mass]{.term2} times the [speed of light]{.term3} squared.
435-
436-
## .term1
437-
438-
Energy (E) is the capacity to do work, measured in joules.
439-
440-
## .term2
441-
442-
Mass (m) is the amount of matter in an object, measured in kilograms.
443-
444-
## .term3
445-
446-
The speed of light (c) is approximately 299,792,458 meters per second.
447-
`;
448-
currentMarkdown = template;
449-
if (editor) {
450-
editor.updateCode(template);
451-
}
452-
} else {
453-
// Exit new mode: reload current equation
454-
newEquationBtn.textContent = 'New';
455-
if (currentEquationId) {
456-
loadEquation(currentEquationId);
457-
}
458-
}
459-
});
460-
}
461-
462-
// Download markdown
463-
const downloadBtn = document.getElementById('download-btn');
464-
if (downloadBtn) {
465-
downloadBtn.addEventListener('click', () => {
466-
const markdown = currentMarkdown || '';
467-
const blob = new Blob([markdown], { type: 'text/markdown' });
468-
const url = URL.createObjectURL(blob);
469-
const a = document.createElement('a');
470-
a.href = url;
471-
a.download = isNewEquationMode ? 'new-equation.md' : `${currentEquationId}.md`;
472-
a.click();
473-
URL.revokeObjectURL(url);
474-
});
475-
}
476-
477-
// Contribute instructions
478-
const contributeBtn = document.getElementById('contribute-btn');
479-
if (contributeBtn) {
480-
contributeBtn.addEventListener('click', () => {
481-
showContributeInstructions();
482-
});
483-
}
484-
}
485-
486-
function showContributeInstructions() {
487-
const instructions = `To contribute your equation to the repository:
488-
489-
1. Download your markdown file using the Download button
490-
2. Fork the repository: https://github.com/stared/equations-explained-colorfully
491-
3. Add your .md file to the public/examples/ directory
492-
4. Add an entry to public/examples/equations.json:
493-
{
494-
"id": "your-equation-id",
495-
"title": "Your Equation Name",
496-
"category": "Field (e.g., Physics, Math)",
497-
"file": "your-file.md"
498-
}
499-
5. Submit a pull request with your changes
500-
501-
Thank you for contributing!`;
502-
503-
alert(instructions);
504410
}
505411

506412
// Initialize - load content and render

src/style.css

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,12 @@ body {
5050
margin: 0 auto;
5151
}
5252

53-
.title-bar {
54-
display: flex;
55-
align-items: baseline;
56-
gap: 1rem;
57-
margin-bottom: 0.5rem;
58-
}
59-
6053
h1 {
6154
font-size: 2rem;
6255
font-weight: 400;
6356
color: var(--text-color);
6457
margin: 0;
65-
}
66-
67-
.source-link {
68-
font-size: 0.875rem;
69-
color: #6b7280;
70-
text-decoration: none;
71-
border-bottom: 1px solid transparent;
72-
transition: color 0.2s ease, border-color 0.2s ease;
73-
}
74-
75-
.source-link:hover {
76-
color: var(--text-color);
77-
border-bottom-color: #6b7280;
58+
margin-bottom: 0.5rem;
7859
}
7960

8061
.subtitle {
@@ -252,41 +233,54 @@ h1 {
252233

253234
.editor-toolbar {
254235
display: flex;
255-
gap: 0.5rem;
236+
gap: 1rem;
256237
padding: 1rem;
257238
border-bottom: 1px solid var(--border-color);
258-
background-color: #ffffff;
239+
background-color: #f9fafb;
259240
flex-shrink: 0;
241+
align-items: center;
260242
}
261243

262244
.editor-sidebar.collapsed .editor-toolbar {
263245
flex-direction: column;
264-
gap: 0.25rem;
246+
gap: 0.5rem;
265247
padding: 0.5rem 0.25rem;
266248
}
267249

268250
.toolbar-btn {
269-
padding: 0.5rem 0.75rem;
270-
border: 1px solid var(--border-color);
271-
background-color: transparent;
251+
padding: 0;
252+
border: none;
253+
background: none;
272254
color: var(--text-color);
273-
font-size: 0.875rem;
255+
font-size: 1rem;
274256
cursor: pointer;
275257
font-family: inherit;
276-
transition: background-color 0.2s ease, color 0.2s ease;
277-
white-space: nowrap;
258+
transition: opacity 0.2s ease;
278259
}
279260

280261
.toolbar-btn:hover {
281-
background-color: var(--text-color);
282-
color: var(--bg-color);
262+
opacity: 0.6;
283263
}
284264

285-
.editor-sidebar.collapsed .toolbar-btn {
286-
padding: 0.5rem 0.25rem;
287-
font-size: 0.75rem;
265+
.toolbar-link {
266+
font-size: 0.875rem;
267+
color: #6b7280;
268+
text-decoration: none;
269+
border-bottom: 1px solid transparent;
270+
transition: color 0.2s ease, border-color 0.2s ease;
271+
white-space: nowrap;
272+
}
273+
274+
.toolbar-link:hover {
275+
color: var(--text-color);
276+
border-bottom-color: #6b7280;
277+
}
278+
279+
.editor-sidebar.collapsed .toolbar-btn,
280+
.editor-sidebar.collapsed .toolbar-link {
288281
writing-mode: vertical-rl;
289282
text-orientation: mixed;
283+
font-size: 0.875rem;
290284
}
291285

292286
#toggle-editor-btn .icon {

0 commit comments

Comments
 (0)