All files / components/inputs/Checkbox styled.js

100% Statements 9/9
50% Branches 2/4
100% Functions 3/3
100% Lines 9/9

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            1x                       1x                                 1x   1x   1x               1x           1x           1x 1x        
// @flow
/* eslint-disable no-ternary */
 
import styled, { type StyledComponent } from "styled-components"
import type { Theme } from "@bluframe/blublocks"
 
export const Wrapper: StyledComponent<{||}, Theme, HTMLElement> = styled.div`
  align-items: center;
  column-gap: 8px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
`
 
export const Input: StyledComponent<
  {||},
  Theme,
  HTMLElement
> = styled.input.attrs({ type: "checkbox" })`
  border: 0;
  clip: rect(0 0 0 0);
  clippath: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
`
 
export const StyledCheckbox: StyledComponent<
  {| checked: boolean |},
  Theme,
  HTMLElement
> = styled.div`
  background: ${({ checked, theme }: { checked: boolean, theme: Theme }) =>
    checked ? theme.palette.primary.main : theme.palette.primary.contrast};
  border: ${({ checked, theme }: { checked: boolean, theme: Theme }) =>
    checked ? "none" : `1px solid ${theme.palette.primary.main}`};
  border-radius: 3px;
  display: inline-block;
  height: 16px;
  transition: all 150ms;
  width: 16px;
`
 
export const Icon: StyledComponent<{||}, Theme, any> = styled.svg`
  fill: none;
  stroke: white;
  stroke-width: 2px;
`
 
export const Polyline: StyledComponent<{||}, Theme, any> = styled.polyline``
 
export const Label: StyledComponent<
  {||},
  Theme,
  HTMLLabelElement
> = styled.label`
  color: ${({ theme }: { theme: Theme }) => theme.palette.text.main};
  cursor: pointer;
  font-size: 16px;
`