Skip to content

Commit 5bcebd4

Browse files
Copilotmikebarkmin
andcommitted
Add close button (X) to help dialog header for better mobile usability
- Added X icon import from lucide-react - Restructured help dialog with separate header, content, and footer sections - Added close button in header with X icon for easier access on mobile - Updated CSS to properly style the new header/footer structure with borders - Content section now scrolls independently while header/footer remain fixed Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
1 parent 3898e76 commit 5bcebd4

2 files changed

Lines changed: 54 additions & 21 deletions

File tree

packages/learningmap/src/LearningMapEditor.tsx

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import FloatingEdge from "./FloatingEdge";
3030
import { EditorToolbar } from "./EditorToolbar";
3131
import { parseRoadmapData } from "./helper";
3232
import { LearningMap } from "./LearningMap";
33-
import { Info, Redo, Undo, RotateCw, ShieldAlert } from "lucide-react";
33+
import { Info, Redo, Undo, RotateCw, ShieldAlert, X } from "lucide-react";
3434
import useUndoable from "./useUndoable";
3535
import { MultiNodePanel } from "./MultiNodePanel";
3636
import { getTranslations } from "./translations";
@@ -936,24 +936,33 @@ export function LearningMapEditor({
936936
open={helpOpen}
937937
onClose={() => setHelpOpen(false)}
938938
>
939-
<h2>{t.keyboardShortcuts}</h2>
940-
<table>
941-
<thead>
942-
<tr>
943-
<th>{t.action}</th>
944-
<th>{t.shortcut}</th>
945-
</tr>
946-
</thead>
947-
<tbody>
948-
{keyboardShortcuts.map((item) => (
949-
<tr key={item.action}>
950-
<td>{item.action}</td>
951-
<td>{item.shortcut}</td>
939+
<header className="help-header">
940+
<h2>{t.keyboardShortcuts}</h2>
941+
<button className="close-button" onClick={() => setHelpOpen(false)} aria-label={t.close}>
942+
<X size={20} />
943+
</button>
944+
</header>
945+
<div className="help-content">
946+
<table>
947+
<thead>
948+
<tr>
949+
<th>{t.action}</th>
950+
<th>{t.shortcut}</th>
952951
</tr>
953-
))}
954-
</tbody>
955-
</table>
956-
<button className="primary-button" onClick={() => setHelpOpen(false)}>{t.close}</button>
952+
</thead>
953+
<tbody>
954+
{keyboardShortcuts.map((item) => (
955+
<tr key={item.action}>
956+
<td>{item.action}</td>
957+
<td>{item.shortcut}</td>
958+
</tr>
959+
))}
960+
</tbody>
961+
</table>
962+
</div>
963+
<div className="help-footer">
964+
<button className="primary-button" onClick={() => setHelpOpen(false)}>{t.close}</button>
965+
</div>
957966
</dialog>
958967
<ShareDialog
959968
open={shareDialogOpen}

packages/learningmap/src/index.css

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,16 +628,40 @@ dialog.help[open] {
628628
border: none;
629629
border-radius: 12px;
630630
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
631-
padding: 24px;
631+
padding: 0;
632632
background: white;
633633
position: fixed;
634634
top: 50%;
635635
transform: translateY(-50%);
636-
gap: 16px;
637636
display: flex;
638637
flex-direction: column;
639638
z-index: 1000;
640-
overflow-y: auto;
639+
overflow: hidden;
640+
641+
.help-header {
642+
padding: 24px 24px 16px 24px;
643+
display: flex;
644+
justify-content: space-between;
645+
align-items: center;
646+
border-bottom: 1px solid #e5e7eb;
647+
648+
h2 {
649+
margin: 0;
650+
font-size: 24px;
651+
font-weight: 700;
652+
}
653+
}
654+
655+
.help-content {
656+
flex: 1;
657+
overflow-y: auto;
658+
padding: 16px 24px;
659+
}
660+
661+
.help-footer {
662+
padding: 16px 24px 24px 24px;
663+
border-top: 1px solid #e5e7eb;
664+
}
641665

642666
table {
643667
width: 100%;

0 commit comments

Comments
 (0)