-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (89 loc) · 5.07 KB
/
index.html
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css">
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.12.0/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js"></script>
<script src="./scripts/main.js"></script>
<title>Todos</title>
</head>
<body>
<!-- NAV -->
<nav class="navbar navbar-expand-lg bg-dark bg-body-tertiary" data-bs-theme="dark">
<div class="container">
<a class="navbar-brand" href="/">Todos</a>
</div>
</div>
</nav>
<div x-data="todoData" class="container">
<form x-on:submit.prevent="addTodo">
<div class="input-group mt-3 mb-3">
<input x-model="newTodoTitle" type="text" class="form-control" placeholder="Enter new Todo item" aria-label="New Todo" aria-describedby="addNewTodo" required>
<button class="btn btn-primary" type="submit" id="addNewTodo">Add</button>
</div>
</form>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="active-tab" data-bs-toggle="tab" data-bs-target="#active-tab-pane" type="button" role="tab" aria-controls="active-tab-pane" aria-selected="true">Active</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="done-tab" data-bs-toggle="tab" data-bs-target="#done-tab-pane" type="button" role="tab" aria-controls="done-tab-pane" aria-selected="false">Done</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="active-tab-pane" role="tabpanel" aria-labelledby="active-tab" tabindex="0">
<div x-show="todosActive.length === 0" class="mt-5 center text-center">
<p class="lead">No todos</p>
</div>
<!-- active todos -->
<ul class="list-group mt-3">
<template x-for="todo in todosActive" x-bind:key="todo.id">
<li class="list-group-item list-group-item d-flex justify-content-between align-items-center flex-wrap">
<div>
<div class="form-check">
<input x-on:click="updateTodo(todo.id)" class="form-check-input" type="checkbox" x-bind:value="todo.isDone" x-bind:id="'todo' + todo.id">
<label class="form-check-label" x-bind:for="'todo' + todo.id">
<strong><span x-text="todo.title"></span></strong>
</label>
</div>
</div>
<button x-on:click="deleteTodo(todo.id)" type="button" class="btn btn-danger btn-sm">
<i class="bi bi-x"></i>
</button>
</li>
</template>
</ul>
</div>
<div class="tab-pane fade" id="done-tab-pane" role="tabpanel" aria-labelledby="done-tab" tabindex="0">
<div x-show="todosDone.length === 0" class="mt-5 center text-center">
<p class="lead">No todos</p>
</div>
<!-- done todos -->
<ul class="list-group mt-3">
<template x-for="todo in todosDone" x-bind:key="todo.id">
<li class="list-group-item list-group-item d-flex justify-content-between align-items-center">
<div>
<div class="form-check">
<input x-on:click="updateTodo(todo.id)" class="form-check-input" type="checkbox" x-bind:value="todo.isDone" x-bind:id="'todo' + todo.id">
<label class="form-check-label" x-bind:for="'todo' + todo.id">
<strong><span x-text="todo.title"></span></strong>
</label>
</div>
</div>
<button x-on:click="deleteTodo(todo.id)" type="button" class="btn btn-danger btn-sm">
<i class="bi bi-x"></i>
</button>
</li>
</template>
</ul>
</div>
</div>
</div>
<!-- created by Joey Rapista -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
</body>
</html>