Skip to content

Commit 60b4f87

Browse files
committed
Added clear button to date and time directives.
1 parent 6256779 commit 60b4f87

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

src/date-input.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,42 @@
209209
.datetime-input.date .calendar .calendar-body .week .date.inactive {
210210
color: #aaa;
211211
}
212+
213+
214+
/**
215+
* Clear button
216+
*/
217+
.datetime-input.date .clear-button {
218+
position: absolute;
219+
z-index: 5;
220+
bottom: -2.5em;
221+
right: -1px;
222+
cursor: pointer;
223+
outline: none;
224+
border: none;
225+
color: #777;
226+
width: 25%;
227+
height: auto;
228+
font-size: 1.5em;
229+
line-height: 2em;
230+
box-sizing: border-box;
231+
background-color: #efefef;
232+
transition: background-color 0.25s ease-out;
233+
}
234+
.datetime-input.date .clear-button::before {
235+
position: absolute;
236+
left: -1em;
237+
top: 0;
238+
width: 0;
239+
height: 0;
240+
content: "";
241+
border-top: 2em solid #efefef;
242+
border-left: 1em solid transparent;
243+
transition: border 0.25s ease-out;
244+
}
245+
.datetime-input.date .clear-button:hover {
246+
background-color: #ddd;
247+
}
248+
.datetime-input.date .clear-button:hover::before {
249+
border-top-color: #ddd;
250+
}

src/date-input.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,8 @@
3434
</div>
3535
</div>
3636
</div>
37+
<div class="clear-button" ng-if="!!date">
38+
<div ng-click="setDate()">Clear</div>
39+
</div>
3740
</div>
3841
</div>

src/time-input.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,42 @@
206206
95% { opacity: 1.0; }
207207
100% { opacity: 0.0; }
208208
}
209+
210+
211+
/**
212+
* Clear button
213+
*/
214+
.datetime-input.time .clear-button {
215+
position: absolute;
216+
z-index: 5;
217+
bottom: -2.5em;
218+
right: -1px;
219+
cursor: pointer;
220+
outline: none;
221+
border: none;
222+
color: #777;
223+
width: 25%;
224+
height: auto;
225+
font-size: 1.5em;
226+
line-height: 2em;
227+
box-sizing: border-box;
228+
background-color: #efefef;
229+
transition: background-color 0.25s ease-out;
230+
}
231+
.datetime-input.time .clear-button::before {
232+
position: absolute;
233+
left: -1em;
234+
top: 0;
235+
width: 0;
236+
height: 0;
237+
content: "";
238+
border-top: 2em solid #efefef;
239+
border-left: 1em solid transparent;
240+
transition: border 0.25s ease-out;
241+
}
242+
.datetime-input.time .clear-button:hover {
243+
background-color: #ddd;
244+
}
245+
.datetime-input.time .clear-button:hover::before {
246+
border-top-color: #ddd;
247+
}

src/time-input.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@
2828
<div class="arrow arrow-down" ng-click="selected.subtract(1, 'seconds') && onChange()"></div>
2929
</div>
3030
</div>
31+
<div class="clear-button" ng-if="!!time">
32+
<div ng-click="setDate()">Clear</div>
33+
</div>
3134
</div>
3235
</div>

0 commit comments

Comments
 (0)