-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtodo.html
152 lines (130 loc) · 3.69 KB
/
todo.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<head>
<link
rel="stylesheet"
href="https://unicons.iconscout.com/release/v4.0.0/css/line.css"/>
<title>To Do List</title>
<style>
:root {
--icons-color: #4c5773;
--icons-bg-color: #e2e6e9;
--shadow-dark-color: #d3dae7;
--shadow-light-color: #fff;
--main-bg-color: #ecf0f3;
--box-shadow: 1rem 1rem 1rem var(--shadow-dark-color),
-1rem -1rem 1rem var(--shadow-light-color);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: var(--main-bg-color);
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
position: absolute;
}
.app {
width: 300px;
height: 500px;
background: var(--main-bg-color);
box-shadow: var(--box-shadow);
padding: 2rem;
border-radius: 2rem;
overflow: hidden;
}
.app .app-info {
display: flex;
justify-content: start;
align-items: center;
margin-bottom: 2rem;
}
.app-info i {
font-size: 45px;
background: var(--icons-color);
padding: 0.5rem;
color: var(--main-bg-color);
margin-right: 1rem;
border-radius: 30%;
}
h1 {
color: var(--icons-color);
font-family: "Times New Roman", Times, serif;
}
.dotolist-container {
width: 100%;
height: 80%;
}
.dotolist-conatiner.inputField {
background: var(--main-bg-color);
box-shadow: var(--box-shadow);
border-radius: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
input {
width: 80%;
height: 40px;
outline: none;
border: none;
background: var(--main-bg-color);
}
.inputField input[type="text"] {
margin-left: 1rem;
}
.inputField i {
font-size: 20px;
margin-right: 1rem;
cursor: pointer;
}
.create-div {
width: 100%;
height: 40px;
background: var(--icons-bg-color);
margin-top: 1rem;
border-radius: 1rem;
display: flex;
justify-content: start;
align-items: center;
padding-left: 1rem;
cursor: pointer;
}
</style>
</head>
<body>
<div class="app">
<div class="app-info">
<i class="uil uil-adjust-circle"></i>
<h1>To Do List</h1>
</div>
<div class="dotolist-conatiner">
<div class="inputField">
<input type="text" placeholder="type your list.." id="input" />
<i class="uil uil-plus"></i>
</div>
<div class="add-list"></div>
</div>
</div>
<script>
const addList = document.querySelector(".add-list");
const addBtn = document.querySelector(".uil-plus");
const inputField = document.getElementById("input");
addBtn.addEventListener('click', ()=>{
const createElement = document.createElement('div');
createElement.classList.add('create-div');
createElement.innerText = inputField.value;
addList.appendChild(createElement);
inputField.value = "";
createElement.addEventListener('click', ()=>{
createElement.style.textDecoration = 'line-through'
})
createElement.addEventListener('dblclick', ()=>{
addList.removeChild(createElement);
})
})
</script>
</body>
</html>