mirror of
https://github.com/adoyle0/thaw.git
synced 2025-03-12 21:49:49 -04:00
pref: Switch style (#150)
* pref: Switch style * pref: Switch style and ARIA
This commit is contained in:
parent
c8e74113ba
commit
27dbca1c00
2 changed files with 20 additions and 10 deletions
|
@ -37,6 +37,8 @@ pub fn Switch(
|
|||
|
||||
style=move || css_vars.get()
|
||||
on:click=move |_| value.set(!value.get_untracked())
|
||||
role="switch"
|
||||
aria-checked=move || if value.get() { "true" } else { "false" }
|
||||
>
|
||||
<div class="thaw-switch__button"></div>
|
||||
</div>
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
.thaw-switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
height: 19px;
|
||||
padding: 2px 5px 3px;
|
||||
width: 40px;
|
||||
height: 22px;
|
||||
background-color: var(--thaw-background-color);
|
||||
border-radius: 25px;
|
||||
border-radius: 11px;
|
||||
cursor: pointer;
|
||||
box-shadow: inset 0 0 1px 0 rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.4s ease;
|
||||
box-sizing: content-box;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.thaw-switch__button {
|
||||
position: absolute;
|
||||
left: 4px;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
display: inline-block;
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
border-radius: 50%;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 9px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.3),
|
||||
inset 0 0 1px 0 rgba(0, 0, 0, 0.05);
|
||||
|
@ -30,5 +30,13 @@
|
|||
}
|
||||
|
||||
.thaw-switch--active .thaw-switch__button {
|
||||
left: 22px;
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
.thaw-switch--active:active .thaw-switch__button {
|
||||
left: 14px;
|
||||
}
|
||||
|
||||
.thaw-switch:active .thaw-switch__button {
|
||||
width: 24px;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue