File tree 2 files changed +61
-1
lines changed
2 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const filterOption = document.querySelector(".filter-todo");
8
8
//document.addEventListener("DOMContentLoaded", getTodos);
9
9
todoButton . addEventListener ( "click" , addTodo ) ;
10
10
todoList . addEventListener ( "click" , deleteTodo ) ;
11
- // filterOption.addEventListener("click", filterTodo);
11
+ filterOption . addEventListener ( "click" , filterTodo ) ;
12
12
13
13
//Functions
14
14
@@ -59,3 +59,28 @@ function deleteTodo(e) {
59
59
todo . classList . toggle ( "completed" ) ;
60
60
}
61
61
}
62
+
63
+ function filterTodo ( e ) {
64
+ const todos = todoList . childNodes ;
65
+ todos . forEach ( function ( todo ) {
66
+ switch ( e . target . value ) {
67
+ case "all" :
68
+ todo . style . display = "flex" ;
69
+ break ;
70
+ case "completed" :
71
+ if ( todo . classList . contains ( "completed" ) ) {
72
+ todo . style . display = "flex" ;
73
+ } else {
74
+ todo . style . display = "none" ;
75
+ }
76
+ break ;
77
+ case "uncompleted" :
78
+ if ( ! todo . classList . contains ( "completed" ) ) {
79
+ todo . style . display = "flex" ;
80
+ } else {
81
+ todo . style . display = "none" ;
82
+ }
83
+ break ;
84
+ }
85
+ } ) ;
86
+ }
Original file line number Diff line number Diff line change @@ -107,3 +107,38 @@ form button:hover {
107
107
transform : translateY (8rem ) rotateZ (20deg );
108
108
opacity : 0 ;
109
109
}
110
+
111
+ .select {
112
+ margin : 1rem ;
113
+ position : relative;
114
+ overflow : hidden;
115
+ border-radius : 10px ;
116
+ }
117
+
118
+ select {
119
+ -webkit-appearance : none;
120
+ -moz-appearance : none;
121
+ appearance : none;
122
+ outline : none;
123
+ border : none;
124
+ color : # ff6f47 ;
125
+ width : 10rem ;
126
+ cursor : pointer;
127
+ padding : 1rem ;
128
+ }
129
+
130
+ .select ::after {
131
+ content : "\25bc" ;
132
+ position : absolute;
133
+ background : # ff6f47 ;
134
+ top : 0 ;
135
+ right : 0 ;
136
+ padding : 1rem ;
137
+ pointer-events : none;
138
+ transition : all 0.3s ease;
139
+ }
140
+
141
+ .select : hover ::after {
142
+ background : white;
143
+ color : # ff6f47 ;
144
+ }
You can’t perform that action at this time.
0 commit comments