Skip to content

Commit dbd7297

Browse files
authored
Merge pull request #124 from bocan:fix/menu
Improve responsive design and spacing in the editor
2 parents 9022484 + 4d61d36 commit dbd7297

4 files changed

Lines changed: 75 additions & 43 deletions

File tree

client/src/components/Editor.css

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,20 @@
7171
.editor-header {
7272
display: flex;
7373
justify-content: space-between;
74-
align-items: center;
74+
align-items: flex-start;
7575
padding: var(--space-3) var(--space-4);
7676
border-bottom: 1px solid var(--border-color);
7777
background: var(--bg-secondary);
78+
gap: var(--space-3);
79+
flex-wrap: wrap;
80+
min-height: fit-content;
7881
}
7982

8083
.editor-title-row {
8184
display: flex;
8285
align-items: center;
8386
gap: var(--space-2);
87+
flex-shrink: 0;
8488
}
8589

8690
.editor-header h3 {
@@ -118,8 +122,13 @@
118122

119123
.editor-actions {
120124
display: flex;
121-
gap: var(--space-2);
125+
flex-wrap: wrap;
126+
gap: var(--space-1) var(--space-2);
122127
align-items: center;
128+
justify-content: flex-end;
129+
min-width: 0;
130+
flex: 1;
131+
max-width: 100%;
123132
}
124133

125134
.save-status {
@@ -305,18 +314,28 @@
305314
RESPONSIVE: EDITOR HEADER & TOOLBAR
306315
===================================================== */
307316

317+
/* Large screens: compact button spacing */
318+
@media (max-width: 1200px) {
319+
.editor-actions {
320+
gap: var(--space-1);
321+
}
322+
323+
.editor-actions button {
324+
padding: var(--space-1) var(--space-2);
325+
}
326+
}
327+
308328
/* Tablet and below: allow the header row to wrap so
309329
action buttons spill to a second row instead of
310330
being pushed off-screen */
311331
@media (max-width: 900px) {
312332
.editor-header {
313-
flex-wrap: wrap;
314333
padding: var(--space-2) var(--space-3);
315334
}
316335

317-
.editor-actions {
318-
flex-wrap: wrap;
319-
gap: var(--space-1);
336+
.editor-actions button {
337+
padding: var(--space-1) var(--space-2);
338+
font-size: var(--text-xs);
320339
}
321340
}
322341

@@ -325,18 +344,30 @@
325344
@media (max-width: 768px) {
326345
.editor-actions {
327346
flex: 0 0 100%;
347+
justify-content: flex-start;
348+
}
349+
350+
.save-status {
351+
order: 10;
352+
flex-basis: 100%;
353+
text-align: left;
354+
margin-top: var(--space-1);
328355
}
329356
}
330357

331-
/* Mobile (≤480px): tighter button padding so more
332-
buttons fit per row; hide verbose save status */
333-
@media (max-width: 480px) {
358+
/* Mobile (≤600px): icon-only buttons */
359+
@media (max-width: 600px) {
334360
.editor-actions button {
335-
padding: var(--space-1) var(--space-2);
336-
font-size: var(--text-xs);
361+
padding: var(--space-2);
337362
}
338363

339-
.save-status {
364+
/* Hide button text labels, keep icons */
365+
.editor-actions .btn-label {
366+
display: none;
367+
}
368+
369+
.save-status,
370+
.save-error span {
340371
display: none;
341372
}
342373
}

client/src/components/Editor.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,35 +522,39 @@ export const Editor: React.FC<EditorProps> = ({ pagePath, onClose }) => {
522522
}
523523
aria-pressed={isListening}
524524
>
525-
<Mic size={14} aria-hidden="true" />{" "}
526-
{isListening ? "Stop" : "Dictate"}
525+
<Mic size={14} aria-hidden="true" />
526+
<span className="btn-label">{isListening ? "Stop" : "Dictate"}</span>
527527
</button>
528528
<button
529529
onClick={() => setShowAttachments(true)}
530530
className="attachments-btn"
531531
title="Manage attachments"
532532
aria-label="Manage attachments"
533533
>
534-
<Paperclip size={14} aria-hidden="true" /> Attachments
534+
<Paperclip size={14} aria-hidden="true" />
535+
<span className="btn-label">Attachments</span>
535536
</button>
536537
<button
537538
onClick={() => setShowHistory(true)}
538539
className="history-btn"
539540
title="View version history"
540541
aria-label="View version history"
541542
>
542-
<History size={14} aria-hidden="true" /> History
543+
<History size={14} aria-hidden="true" />
544+
<span className="btn-label">History</span>
543545
</button>
544546
<button
545547
onClick={handleSave}
546548
disabled={isSaving}
547549
title="Save page"
548550
aria-label="Save page"
549551
>
550-
<Save size={14} aria-hidden="true" /> {isSaving ? "Saving..." : "Save"}
552+
<Save size={14} aria-hidden="true" />
553+
<span className="btn-label">{isSaving ? "Saving..." : "Save"}</span>
551554
</button>
552555
<button onClick={onClose} title="Close editor" aria-label="Close editor">
553-
<X size={14} aria-hidden="true" /> Close
556+
<X size={14} aria-hidden="true" />
557+
<span className="btn-label">Close</span>
554558
</button>
555559
</div>
556560
</div>

client/src/components/Preview.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,21 @@
386386
font-style: italic;
387387
}
388388

389+
/* Span-based image figure (avoids <figure> in <p> hydration errors) */
390+
.preview-content .image-figure {
391+
display: block;
392+
margin: var(--space-4) 0;
393+
text-align: center;
394+
}
395+
396+
.preview-content .image-caption {
397+
display: block;
398+
margin-top: var(--space-2);
399+
font-size: var(--text-sm);
400+
color: var(--text-muted);
401+
font-style: italic;
402+
}
403+
389404
.preview-content hr {
390405
border: none;
391406
height: 1px;

client/src/components/Preview.tsx

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -524,22 +524,13 @@ const MarkdownRenderer = React.memo(function MarkdownRenderer({
524524
const filename = src.replace(".attachments/", "");
525525
const fullUrl = api.getAttachmentUrl(folderPath, filename);
526526

527-
// Wrap in figure with caption if alt text exists
527+
// Wrap in span-based figure if alt text exists (avoids <figure> in <p> hydration error)
528528
if (alt) {
529529
return (
530-
<figure style={{ margin: "16px 0", textAlign: "center" }}>
530+
<span className="image-figure" role="figure" aria-label={alt}>
531531
<img {...props} src={fullUrl} alt={alt} />
532-
<figcaption
533-
style={{
534-
marginTop: "8px",
535-
fontSize: "0.9em",
536-
color: "var(--text-secondary)",
537-
fontStyle: "italic",
538-
}}
539-
>
540-
{alt}
541-
</figcaption>
542-
</figure>
532+
<span className="image-caption">{alt}</span>
533+
</span>
543534
);
544535
}
545536
return <img {...props} src={fullUrl} alt={filename} />;
@@ -548,19 +539,10 @@ const MarkdownRenderer = React.memo(function MarkdownRenderer({
548539
// For non-attachment images, still show caption if alt text exists
549540
if (alt) {
550541
return (
551-
<figure style={{ margin: "16px 0", textAlign: "center" }}>
542+
<span className="image-figure" role="figure" aria-label={alt}>
552543
<img {...props} />
553-
<figcaption
554-
style={{
555-
marginTop: "8px",
556-
fontSize: "0.9em",
557-
color: "var(--text-secondary)",
558-
fontStyle: "italic",
559-
}}
560-
>
561-
{alt}
562-
</figcaption>
563-
</figure>
544+
<span className="image-caption">{alt}</span>
545+
</span>
564546
);
565547
}
566548

0 commit comments

Comments
 (0)