84 lines
2.0 KiB
CSS
84 lines
2.0 KiB
CSS
/*
|
|
Copyright 2023 New Vector Ltd
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
.toggle {
|
|
padding: 2px;
|
|
border: 1px solid var(--cpd-color-border-interactive-secondary);
|
|
border-radius: var(--cpd-radius-pill-effect);
|
|
box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
}
|
|
|
|
.toggle input {
|
|
appearance: none;
|
|
/*
|
|
* Safari puts a margin on these, which is not removed via appearance: none
|
|
* mobile safari also has them take up space in the DOM, so set width 0
|
|
*/
|
|
margin: 0;
|
|
width: 0;
|
|
outline: none !important;
|
|
}
|
|
|
|
.toggle label {
|
|
display: block;
|
|
padding: calc(2.5 * var(--cpd-space-1x));
|
|
cursor: pointer;
|
|
border-radius: var(--cpd-radius-pill-effect);
|
|
color: var(--cpd-color-icon-primary);
|
|
background: var(--cpd-color-bg-action-secondary-rest);
|
|
box-shadow: var(--small-drop-shadow);
|
|
}
|
|
|
|
@media (hover: hover) {
|
|
.toggle label:hover {
|
|
background: var(--cpd-color-bg-action-secondary-hovered);
|
|
box-shadow: none;
|
|
}
|
|
}
|
|
|
|
.toggle label:active {
|
|
background: var(--cpd-color-bg-action-secondary-hovered);
|
|
box-shadow: none;
|
|
}
|
|
|
|
.toggle input:checked + label {
|
|
color: var(--cpd-color-icon-on-solid-primary);
|
|
background: var(--cpd-color-bg-action-primary-rest);
|
|
}
|
|
|
|
@media (hover: hover) {
|
|
.toggle input:checked + label:hover {
|
|
background: var(--cpd-color-bg-action-primary-hovered);
|
|
}
|
|
}
|
|
|
|
.toggle input:checked + label:active {
|
|
background: var(--cpd-color-bg-action-primary-hovered);
|
|
}
|
|
|
|
.toggle label > svg {
|
|
display: block;
|
|
}
|
|
|
|
.toggle label:last-child {
|
|
margin-inline-start: 5px;
|
|
}
|
|
|
|
.toggle input:focus-visible + label {
|
|
outline: auto;
|
|
}
|