Skip to content

Commit 6f08534

Browse files
committed
Multi-line checklist names in sidebar
1 parent 463a30e commit 6f08534

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/components/sidebar/ChecklistLeaf.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Icon } from "../../icons";
66
import { countItems } from "../../itemUtils";
77
import { useDispatch } from "../../state";
88
import { useConfirm } from "../common/confirmContext";
9+
import { EditableText } from "../common/EditableText";
910

1011
interface Props {
1112
checklist: Checklist;
@@ -50,7 +51,15 @@ export function ChecklistLeaf({ checklist, selected, inSection, onSelect }: Prop
5051
>
5152
⋮⋮
5253
</span>
53-
<span className="leaf-name">{checklist.name}</span>
54+
<span className="leaf-name" onPointerDown={(e) => e.stopPropagation()}>
55+
<EditableText
56+
value={checklist.name}
57+
onCommit={(v) => dispatch({ type: "set-checklist-name", id: checklist.id, name: v })}
58+
multiline
59+
clampLines={3}
60+
commit="blur"
61+
/>
62+
</span>
5463
<button
5564
className="vH-del"
5665
title="Delete checklist"

src/components/sidebar/Sidebar.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@
195195

196196
.tree-leaf {
197197
margin: 0 4px 0 18px;
198-
padding: 0 8px 0 18px;
199-
height: 24px;
198+
padding: 1px 8px 1px 18px;
199+
min-height: 24px;
200200
display: flex;
201-
align-items: center;
201+
align-items: start;
202202
border-left: 1px solid var(--bd-1);
203203
border-radius: 0 5px 5px 0;
204204
color: var(--fg-2);
@@ -217,6 +217,7 @@
217217
.tree-leaf .leaf-drag {
218218
width: 10px;
219219
margin-left: -8px;
220+
margin-top: 3px;
220221
color: var(--fg-4);
221222
font-size: 12px;
222223
letter-spacing: -1px;
@@ -236,14 +237,13 @@
236237
}
237238
.tree-leaf .leaf-name {
238239
flex: 1;
239-
overflow: hidden;
240-
text-overflow: ellipsis;
241-
white-space: nowrap;
240+
min-width: 0;
242241
}
243242
.tree-leaf .leaf-meta {
244243
font-family: var(--font-mono);
245244
font-size: 11px;
246245
color: var(--fg-4);
246+
margin-top: 4px;
247247
}
248248
.tree-leaf.selected {
249249
background: var(--accent-soft);

0 commit comments

Comments
 (0)