add inputbox and clearn todo html even more

This commit is contained in:
Fabio Pliger
2022-04-20 16:12:01 -05:00
parent 3aa3ba02be
commit 44afda7aa8
4 changed files with 68 additions and 25 deletions

View File

@@ -17,29 +17,20 @@
<py-register-widget src="/pylist.py" name="py-list" klass="PyList"></py-widget>
</head>
<body class="container">
<main class="max-w-xs mx-auto mt-4">
<section>
<py-title>To Do List</py-title>
<div>
<input id="new-task-content" class="border flex-1 mr-3 border-gray-300 p-2 rounded" type="text" py-mount>
<py-button id="new-task-btn" label="Add Task!">
def on_click(evt):
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() }
myList.add(PyItem(task, labels=['content'], state_key="done"))
new_task_content.clear()
</button>
</div>
<py-list id="myList"></py-list>
<body>
<py-title>To Do List</py-title>
<py-box widths="2/3;1/3">
<py-inputbox id="new-task-content"></py-inputbox>
<py-button id="new-task-btn" label="Add Task!">
def on_click(evt):
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() }
myList.add(PyItem(task, labels=['content'], state_key="done"))
new_task_content.clear()
</button>
</py-box>
<py-repl id="my-repl" auto-generate="true"> </py-repl>
</section>
</main>
</body>
<py-list id="myList"></py-list>
<py-repl id="my-repl" auto-generate="true"> </py-repl>
</body>
</html>