frontend: add default task content
This commit is contained in:
parent
2c22ea86d8
commit
bc40874980
3 changed files with 22 additions and 7 deletions
|
@ -39,12 +39,13 @@
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: #cfcfc4 1px solid;
|
border: #cfcfc4 1px solid;
|
||||||
.task.content {
|
.task.content {
|
||||||
p:first-child strong:first-child {
|
padding: 10px;
|
||||||
margin: 0 0 5px 0;
|
|
||||||
}
|
h3,h4,h5 {
|
||||||
p strong:first-child {
|
&:first-child {
|
||||||
display: block;
|
margin: 0 0 5px 0;
|
||||||
margin: 10px 0 5px 0;
|
}
|
||||||
|
margin: 15px 0 5px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,18 @@ type Inputs = {
|
||||||
projectId: number;
|
projectId: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const DEFAULT_TASK_CONTENT = [
|
||||||
|
"## Subtasks",
|
||||||
|
"",
|
||||||
|
"* [] Task 1",
|
||||||
|
"* [] Task 2",
|
||||||
|
"* [] ...",
|
||||||
|
"",
|
||||||
|
"## Description",
|
||||||
|
"",
|
||||||
|
"Add a description here....",
|
||||||
|
].join("\n");
|
||||||
|
|
||||||
export function Task({ task }: { task?: Task }) {
|
export function Task({ task }: { task?: Task }) {
|
||||||
const { register, handleSubmit, watch, setValue: set } = useForm<Inputs>();
|
const { register, handleSubmit, watch, setValue: set } = useForm<Inputs>();
|
||||||
const [isEditable, setIsEditable] = useState<boolean>(!task);
|
const [isEditable, setIsEditable] = useState<boolean>(!task);
|
||||||
|
@ -66,7 +78,7 @@ export function Task({ task }: { task?: Task }) {
|
||||||
<textarea
|
<textarea
|
||||||
className="form"
|
className="form"
|
||||||
placeholder="Add your description heren"
|
placeholder="Add your description heren"
|
||||||
defaultValue={task?.content}
|
defaultValue={task?.content || DEFAULT_TASK_CONTENT}
|
||||||
{...register("content", { required: true })}
|
{...register("content", { required: true })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,6 +6,8 @@ const DEFAULT_RENDER_OPTIONS = {
|
||||||
strikethrough: true,
|
strikethrough: true,
|
||||||
tables: true,
|
tables: true,
|
||||||
tasklists: true,
|
tasklists: true,
|
||||||
|
ghCodeBlocks: true,
|
||||||
|
headerLevelStart: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function rendermd(str: string, options = {}) {
|
export function rendermd(str: string, options = {}) {
|
||||||
|
|
Loading…
Reference in a new issue