Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 2x 2x 2x 12x 12x 2x 12x 2x 5x 2x 12x 12x | /* eslint-disable no-ternary */
import { Theme } from "styles/theme"
import styled from "styled-components"
export const Wrapper = styled.div`
display: grid;
`
export const Input = styled.input`
display: none;
&:checked + label:before {
left: 22px;
}
&:checked + label {
background: ${({ theme }: { theme: Theme }) => theme.palette.primary.main};
}
&:disabled + label {
background: ${({ theme }: { theme: Theme }) => theme.palette.disabled.main};
cursor: not-allowed;
pointer-events: none;
}
`
export const SwitchAndLabel = styled.div<{ $hasLabel: boolean }>`
display: grid;
${({ $hasLabel }) =>
$hasLabel
? `
align-items: center;
column-gap: 4px;
grid-template-columns: auto 1fr;`
: ""}
`
export const Label = styled.label`
color: ${({ theme }: { theme: Theme }) => theme.palette.text.main};
cursor: pointer;
font-size: 16px;
`
export const Switch = styled.label`
position: relative;
width: 40px;
height: 20px;
background: ${({ theme }: { theme: Theme }) => theme.palette.disabled.main};
border-radius: 20px;
cursor: pointer;
&:before {
content: "";
position: absolute;
top: 2px;
left: 2px;
width: 16px;
height: 16px;
background: ${({ theme }: { theme: Theme }) =>
theme.palette.primary.contrast};
border-radius: 50%;
transition: left 0.2s;
}
`
|