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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | import styled, {css, keyframes} from 'styled-components'; import defaultTheme from '../../theme'; const drawCheckbox = keyframes` 0% { stroke-dashoffset: 33; } 100% { stroke-dashoffset: 0; } `; const height = 36; const width = 36; const StyledCheckbox= styled.span` position: relative; display: inline-block; height: ${height}px; width: ${width}px; .checkbox { position: absolute; border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; width: 1px; &:checked + label > svg { display: block; height: ${height / 2}px; animation: ${drawCheckbox} ease-in-out 0.2s forwards; } } label { color: ${props => props.theme.primaryColor}; line-height: ${height}px; cursor: pointer; position: relative; &:active::after { background-color: ${props => props.theme.grayColor}; } &:after { content: ""; height: ${height - 4}px; width: ${width - 4}px; margin-right: 1rem; float: left; border: 2px solid ${props => props.theme.primaryColor}; border-radius: 3px; transition: 0.15s all ease-out; } } svg { display: none; stroke: ${props => props.theme.primaryColor}; stroke-width: 3px; height: 0; //Firefox fix width: ${height / 2}px; position: absolute; top: 8px; left: 9px; stroke-dasharray: 33; //Firefox fix } ${props => props.style && css` ${props.style} `} `; const StyledLabel = styled.label` font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; `; StyledCheckbox.defaultProps = { theme: defaultTheme }; StyledLabel.defaultProps = { theme: defaultTheme }; export { StyledCheckbox, StyledLabel }; |