Skip to content

Commit

Permalink
Added task header
Browse files Browse the repository at this point in the history
- Fix issues with clicking links fixes #40
- Allow for text selection fixes #42
  • Loading branch information
mayank1513 committed Jul 3, 2024
1 parent 3a030c9 commit b688a3a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 30 deletions.
3 changes: 2 additions & 1 deletion src/components/column-list/column-list.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
overflow-x: hidden;
overflow-y: auto;
max-height: calc(100vh - 200px);
padding: 0;
padding: 0 10px;
margin: 0 -10px;
}
.close {
display: none;
Expand Down
31 changes: 17 additions & 14 deletions src/components/task/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,27 @@ export default function Task({ task, index }: { task: TaskType; index: number })
provided.draggableProps.style.transform += " rotate(5deg)";
return (
<label
onClick={() => vscode.toast("Double-click to enter editing mode!")}
onDoubleClick={() => {
setIsEditing(true);
resizeTextArea(textareaRef);
if (textareaRef.current?.value) {
textareaRef.current.value = "hk";
textareaRef.current.value = task.description;
}
}}
title="Double click to enter editing mode."
htmlFor={id}
ref={provided.innerRef}
{...provided.dragHandleProps}
{...provided.draggableProps}
className={[styles.task, isEditing ? styles.active : ""].join(" ")}>
<header {...provided.dragHandleProps}>
<span>∘∘∘</span>
<button className={styles.close} onClick={removeTask}>
</button>
<button
onClick={() => {
setIsEditing(true);
if (textareaRef.current?.value) {
textareaRef.current.value = "hk";
textareaRef.current.value = task.description;
}
setTimeout(() => resizeTextArea(textareaRef), 100);
}}>
🖉
</button>
</header>
<textarea
id={id}
value={task.description}
Expand All @@ -66,9 +72,6 @@ export default function Task({ task, index }: { task: TaskType; index: number })
placeholder="Enter task description in Markdown format"
hidden={!isEditing}
/>
<span className={styles.close} onClick={removeTask}>
</span>
{!isEditing &&
(task.description.trim() ? (
<ReactMarkdown rehypePlugins={[rehypeRaw]}>{task.description.replace(/\n+/g, "\n\n")}</ReactMarkdown>
Expand Down
44 changes: 29 additions & 15 deletions src/components/task/task.module.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
.task {
margin: 5px;
margin-bottom: 10px;
padding: 5px;
border-radius: 5px;
border: 1px solid gray;
box-shadow: 0 0 5px #555;
display: block;
position: relative;
background: var(--bg);
header {
text-align: center;
box-shadow: 0 0 2px currentColor;
margin: -5px;
margin-bottom: -5px;
margin-bottom: 0;
border-radius: 5px 5px 0 0;
padding-bottom: 2px;
position: relative;
button {
all: unset;
position: absolute;
right: 24px;
top: 0;
cursor: pointer;
padding: 0 5px;
&:hover {
color: orange;
}
}

.close {
right: 2px;
&:hover {
color: red;
}
}
}
textarea {
width: calc(100% - 10px);
resize: none;
Expand All @@ -18,24 +46,10 @@
ul {
padding-left: 20px;
}
&:hover .close {
display: block;
}
}
.active {
box-shadow: 0 0 5px red;
}
.placeholder {
opacity: 0.5;
}
.close {
position: absolute;
right: 5px;
top: -5px;
display: none;
cursor: pointer;
z-index: 100;
&:hover {
color: red;
}
}

0 comments on commit b688a3a

Please sign in to comment.