Added proposal for implementing strikethrough feature for TODO app. (#50)

This commit is contained in:
Matija Sosic 2019-11-06 16:40:45 +01:00 committed by GitHub
parent 5bc505429f
commit 466a3a7739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ stic.cabal
/.dir-locals.el /.dir-locals.el
stack*.yaml.lock stack*.yaml.lock
/out /out
*.swp
*.DS_Store

View File

@ -38,6 +38,10 @@ page Main {
<button onClick={() => this.setState({ taskFilter: task => !task.isDone })}> Active </button> <button onClick={() => this.setState({ taskFilter: task => !task.isDone })}> Active </button>
<button onClick={() => this.setState({ taskFilter: task => task.isDone })}> Completed </button> <button onClick={() => this.setState({ taskFilter: task => task.isDone })}> Completed </button>
</div> </div>
<button onClick=(tasks) => {// Change state.} />
</div> </div>
jsx=}, jsx=},
@ -58,6 +62,11 @@ page Main {
css=} css=}
} }
const toggleTasksDone = (tasks) => {
// If all tasks are done, set them all to active.
// Otherwise - set them all to false.
}
// TODO: This part is not currently supported at all. // TODO: This part is not currently supported at all.
entity-form<Task> CreateTaskForm { entity-form<Task> CreateTaskForm {
fields: { fields: {
@ -78,5 +87,18 @@ entity-form<Task> CreateTaskForm {
// TODO: This part is not currently supported at all. // TODO: This part is not currently supported at all.
entity-list<Task> TaskList { entity-list<Task> TaskList {
allowItemEditing: true, allowItemEditing: true,
allowItemDeletion: true // Items can be deleted, and this also deletes them for real. allowItemDeletion: true, // Items can be deleted, and this also deletes them for real.
fields: {
description: {
// The contract for render is: user can provide a function that:
// - receives a task as an input
// - returns a React Node or something that can be rendered by JSX
// - does not depend on any outer context
render: (task) => {
if (task.isDone) return (<s>task.description</s>)
return task.description
}
}
}
} }