89 lines
2.1 KiB
CSS
89 lines
2.1 KiB
CSS
/*
|
|
Copyright 2023-2024 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);
|
|
background: var(--cpd-color-bg-canvas-default);
|
|
display: flex;
|
|
position: relative;
|
|
}
|
|
|
|
.toggle input {
|
|
appearance: none;
|
|
/* Safari puts a margin on these, which is not removed via appearance: none */
|
|
margin: 0;
|
|
block-size: var(--cpd-space-11x);
|
|
inline-size: var(--cpd-space-11x);
|
|
cursor: pointer;
|
|
border-radius: var(--cpd-radius-pill-effect);
|
|
background: var(--cpd-color-bg-action-secondary-rest);
|
|
box-shadow: var(--small-drop-shadow);
|
|
transition: background-color 0.1s;
|
|
}
|
|
|
|
.toggle svg {
|
|
display: block;
|
|
position: absolute;
|
|
padding: calc(2.5 * var(--cpd-space-1x));
|
|
pointer-events: none;
|
|
color: var(--cpd-color-icon-primary);
|
|
transition: color 0.1s;
|
|
}
|
|
|
|
.toggle svg:nth-child(2) {
|
|
inset-inline-start: 2px;
|
|
}
|
|
|
|
.toggle svg:nth-child(4) {
|
|
inset-inline-end: 2px;
|
|
}
|
|
|
|
@media (hover: hover) {
|
|
.toggle input:hover {
|
|
background: var(--cpd-color-bg-action-secondary-hovered);
|
|
box-shadow: none;
|
|
}
|
|
}
|
|
|
|
.toggle input:active {
|
|
background: var(--cpd-color-bg-action-secondary-pressed);
|
|
box-shadow: none;
|
|
}
|
|
|
|
.toggle input:checked {
|
|
background: var(--cpd-color-bg-action-primary-rest);
|
|
}
|
|
|
|
.toggle input:checked + svg {
|
|
color: var(--cpd-color-icon-on-solid-primary);
|
|
}
|
|
|
|
@media (hover: hover) {
|
|
.toggle input:checked:hover {
|
|
background: var(--cpd-color-bg-action-primary-hovered);
|
|
}
|
|
}
|
|
|
|
.toggle input:checked:active {
|
|
background: var(--cpd-color-bg-action-primary-pressed);
|
|
}
|
|
|
|
.toggle input:first-child {
|
|
margin-inline-end: 5px;
|
|
}
|