add skip inactive switch and use rrweb timer to display current time

This commit is contained in:
Yanzhen Yu
2018-12-27 13:10:03 +08:00
parent d8b8d2d531
commit e5cb062995
5 changed files with 123 additions and 15 deletions

View File

@@ -0,0 +1,77 @@
<div class="switch" class:disabled="disabled">
<input
type="checkbox"
id="{id}"
bind:checked="checked"
disabled="{disabled}"
/>
<label for="{id}"></label> <span class="label">{label}</span>
</div>
<style>
.switch {
height: 1em;
display: flex;
align-items: center;
}
.switch.disabled {
opacity: 0.5;
}
.label {
margin: 0 8px;
height: 1em;
}
.switch input[type='checkbox'] {
position: absolute;
opacity: 0;
}
.switch label {
width: 2em;
height: 1em;
position: relative;
cursor: pointer;
display: block;
}
.switch.disabled label {
cursor: not-allowed;
}
.switch label:before {
content: '';
position: absolute;
width: 2em;
height: 1em;
left: 0.1em;
transition: background 0.1s ease;
background: rgba(73, 80, 246, 0.5);
border-radius: 50px;
}
.switch label:after {
content: '';
position: absolute;
width: 1em;
height: 1em;
border-radius: 50px;
left: 0;
transition: all 0.2s ease;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
background: #fcfff4;
animation: switch-off 0.2s ease-out;
z-index: 2;
}
.switch input[type='checkbox']:checked + label:before {
background: rgb(73, 80, 246);
}
.switch input[type='checkbox']:checked + label:after {
animation: switch-on 0.2s ease-out;
left: 1.1em;
}
</style>