forked from mattzeunert/CSS-Todo-App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.css
211 lines (185 loc) · 5.38 KB
/
todo.css
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/* Styling for new todo item input */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.created-checkbox:not(:checked) ~ .todo-input {
position: absolute;
top: 0;
padding-left: calc(15px + 40px);
box-shadow: inset 0 -2px 1px rgba(0,0,0,0.03);
}
.created-checkbox:not(:checked) ~ .todo-input,
.created-checkbox:not(:checked) ~ .created-checkbox-label {
border-bottom: 1px solid #e6e6e6;
}
/* Mark as done/not done */
.done-checkbox,
.mark-done-checkbox-label,
.mark-undone-checkbox-label {
display: none;
}
.mark-done-checkbox-label,
.mark-undone-checkbox-label {
cursor: pointer;
padding-top: 13px;
padding-bottom: 11px;
border-bottom: 1px solid #ededed;
}
/* Show mark as done if item is created and not marked as done yet */
.created-checkbox:checked ~ .done-checkbox:not(:checked) ~ .mark-done-checkbox-label {
display: inline-block;
}
/* Show mark as undone if item is created and marked as done */
.created-checkbox:checked ~ .done-checkbox:checked ~ .mark-undone-checkbox-label {
display: inline-block;
}
/* Item creation */
.created-checkbox-label {
position: absolute;
top: 0;
right: 0px;
width: 40px;
cursor: pointer;
background: #d6d6d6;
font-weight: bold;
padding: 22px;
padding-left: 10px;
padding-right: 10px;
text-align: center;
}
.created-checkbox-label:hover {
background: #ddd;
}
/* Don't allow creating empty items */
input:not(:valid) ~ .created-checkbox-label {
pointer-events: none;
}
.created-checkbox {
display: none;
}
.created-checkbox:checked + input {
border: none;
}
/* Item creation state */
.created-checkbox:checked ~ .todo > .todo-input,
.created-checkbox:checked ~ .todo > .created-checkbox-label {
display: inline-block;
}
.created-checkbox:checked ~ .created-checkbox-label {
display: none !important;
}
/* Item deletion */
.deleted-checkbox-label,
.deleted-checkbox {
display: none;
}
.deleted-checkbox-label {
display: none;
width: 60px;
margin: auto 0;
font-size: 30px;
transition: color 0.2s ease-out;
text-align: center;
color: transparent;
border-bottom: 1px solid #ededed;
box-sizing: border-box;
/* unequal padding because the x icon itself is not centered on the line of text*/
padding-top: 17px;
padding-bottom: 28px;
cursor: pointer;
}
.deleted-checkbox-label:hover {
color: #af5b5e !important;
}
.created-checkbox:checked ~ .deleted-checkbox-label {
display: inline-block;
}
/* Show the delete icon on hover over any of the item elements */
.created-checkbox:checked ~ .deleted-checkbox-label:hover,
.created-checkbox:checked ~ :not(.todo):hover ~ .deleted-checkbox-label {
color: #cc9a9a;
}
/* If item is deleted hide its elements */
.deleted-checkbox:checked ~ :not(.todo) {
display: none !important;
}
/* Hide items marked as done if filter is active */
.active-filter:target .created-checkbox:checked ~ .done-checkbox:checked ~ .todo-input,
.active-filter:target .created-checkbox:checked ~ .done-checkbox:checked ~ .mark-done-checkbox-label,
.active-filter:target .created-checkbox:checked ~ .done-checkbox:checked ~ .mark-undone-checkbox-label,
.active-filter:target .created-checkbox:checked ~ .done-checkbox:checked ~ .deleted-checkbox-label {
display: none !important;
}
/* Hide items not marked done if filter is completed */
.completed-filter:target .created-checkbox:checked ~ .done-checkbox:not(:checked) ~ .todo-input,
.completed-filter:target .created-checkbox:checked ~ .done-checkbox:not(:checked) ~ .mark-done-checkbox-label,
.completed-filter:target .created-checkbox:checked ~ .done-checkbox:not(:checked) ~ .mark-undone-checkbox-label,
.completed-filter:target .created-checkbox:checked ~ .done-checkbox:not(:checked) ~ .deleted-checkbox-label {
display: none !important;
}
/* Indicate currently selected filter */
.active-filter:target .filter-active,
.completed-filter:target .filter-completed,
.completed-filter:not(:target) .active-filter:not(:target) .filter-all {
border-color: rgba(175, 47, 47, 0.2);
}
/* items-left counter */
body {
counter-reset: items-left;
}
.created-checkbox:checked ~ .deleted-checkbox:not(:checked) ~ .done-checkbox:not(:checked) ~ .items-left-counter-helper {
/* items-left-counter-helper is an empty element that's not hidden by filters */
counter-increment: items-left;
}
#items-left:before {
content: counter(items-left);
}
/* Basic Item styles */
#todo-1 {
position: relative;
padding-top: 65px;
}
#todo-0 > :not(.todo) { /* todo 0 is used to bootstrap the todo-1 as visible (because todo 0 is marked as created) */
display: none;
}
.todo-input {
white-space: pre-line;
word-break: break-all;
padding: 15px 60px 15px 15px;
margin-left: 45px;
display: block;
line-height: 1.2;
transition: color 0.4s;
border: 0;
border: none;
border-bottom: 1px solid #ededed;
background: rgba(0, 0, 0, 0.003);
position: relative;
margin: 0;
width: calc(100% - 175px);
font-size: 24px;
font-family: inherit;
font-weight: inherit;
line-height: 1.4em;
outline: none;
color: inherit;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
}
.todo-input,
.created-checkbox-label {
display: none;
}
.todo {
display: flex;
width: 100%;
flex-wrap: wrap;
}
@media (max-width: 600px) {
body {
padding: 5px;
}
}