-
Notifications
You must be signed in to change notification settings - Fork 622
Expand file tree
/
Copy pathtodo-app.template.ts
More file actions
41 lines (37 loc) · 1.36 KB
/
todo-app.template.ts
File metadata and controls
41 lines (37 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { html } from "@microsoft/fast-element/html.js";
import { repeat } from "@microsoft/fast-element/repeat.js";
import { twoWay } from "@microsoft/fast-element/two-way.js";
import type { TodoApp } from "./todo-app.js";
import type { Todo } from "./todo-list.js";
import "./todo-form.js";
export const template = html<TodoApp>`
<h1>FAST Todos</h1>
<todo-form></todo-form>
<section>
<label for="filter">Filter:</label>
<select name="filter" title="filter" :value=${twoWay(x => x.todos.activeFilter)}>
<option value="all">All</option>
<option value="active">Active</option>
<option value="completed">Completed</option>
</select>
</section>
<ul class="todo-list">
${repeat(
x => x.todos.filtered,
html<Todo, TodoApp>`
<li class="todo">
<input type="checkbox" :checked=${twoWay(x => x.done)} />
<span class="description ${x => (x.done ? "done" : "")}">
${x => x.description}
</span>
<button
@click=${(x, c) => c.parent.todos.remove(x)}
aria-label="Remove item"
>
×
</button>
</li>
`,
)}
</ul>
`;