# All files / Checkbox Checkbox.styled.ts

0% Statements 0/8
100% Branches 0/0
0% Functions 0/4
0% Lines 0/4

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

     import { Style, Styles } from 'jss'
    import { Theme } from '../styles'
    import { CheckboxClassProps } from './Checkbox.type'

    const root = (theme: Theme): Style => ({
      width: 20,
      height: 20,
      display: 'inline-flex',
      alignItems: 'center',
      justifyContent: 'center',
      position: 'relative',
      cursor: 'pointer',
      borderRadius: 2,
      border: '2px solid',
      transition: theme.transitions!.checkbox,
      color: theme.colors!.black!.default,
      backgroundColor: theme.colors!.white!.default,
      borderColor: theme.colors!.standard!.default,
      '&:hover, &:focus': {
        borderColor: theme.colors!.standard!.dark1
      },
      '&:active': {
        color: theme.colors!.white!.default,
        backgroundColor: theme.colors!.primary!.default,
        borderColor: theme.colors!.primary!.default
      },
      '& > input': {
        width: '100%',
        height: '100%',
        cursor: 'pointer',
        opacity: 0,
        position: 'absolute',
        left: 0,
        right: 0,
        top: 0,
        bottom: 0,
        zIndex: 1
      }
    })
    const checked = (theme: Theme): Style => ({
      color: theme.colors!.white!.default,
      backgroundColor: theme.colors!.primary!.default,
      borderColor: theme.colors!.primary!.default,
      '&:hover, &:focus': {
        borderColor: theme.colors!.primary!.default
      },
      '&:active': {
        backgroundColor: theme.colors!.primary!.dark3,
        borderColor: theme.colors!.primary!.dark3
      }
    })
    const disabled = (theme: Theme): Style => ({
      color: theme.colors!.standard!.dark2,
      backgroundColor: theme.colors!.standard!.light1,
      borderColor: theme.colors!.standard!.default,
      pointerEvents: 'none',
      cursor: 'not-allowed'
    })

    export const styles = (theme: Theme): Styles<CheckboxClassProps> => ({
      root: root(theme),
      checked: checked(theme),
      disabled: disabled(theme)
    })