# All files / Button Button.styled.ts

0% Statements 0/15
100% Branches 0/0
0% Functions 0/7
0% Lines 0/8

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

     import { Styles, Style } from 'jss'
    import { ButtonClassProps } from './Button.type'
    import { Theme } from '../styles'

    const root = (theme: Theme): Style => ({
      display: 'inline-block',
      textDecoration: 'none',
      outline: 'none',
      cursor: 'pointer',
      minWidth: 56,
      verticalAlign: 'middle',
      border: '2px solid',
      borderRadius: 2,
      textAlign: 'center',
      lineHeight: 1.5,
      transition: theme.transitions!.button,
      '&:disabled': {
        color: theme.colors!.standard!.dark2,
        backgroundColor: theme.colors!.standard!.light1,
        cursor: 'not-allowed',
        pointerEvents: 'none'
      }
    })
    const variantStandard = (theme: Theme): Style => ({
      color: theme.colors!.black!.default,
      backgroundColor: theme.colors!.white!.default,
      borderColor: theme.colors!.standard!.default,
      '&:hover, &:focus': {
        borderColor: theme.colors!.standard!.dark1
      },
      '&:active': {
        backgroundColor: theme.colors!.standard!.default,
        borderColor: theme.colors!.standard!.dark3
      }
    })
    const variantPrimary = (theme: Theme): Style => ({
      color: theme.colors!.white!.default,
      backgroundColor: theme.colors!.primary!.default,
      borderColor: theme.colors!.primary!.default,
      boxShadow: theme.shadows![3],
      '&:hover, &:focus': {
        backgroundColor: theme.colors!.primary!.dark1,
        borderColor: theme.colors!.primary!.dark1
      },
      '&:active': {
        backgroundColor: theme.colors!.primary!.dark3,
        borderColor: theme.colors!.primary!.dark3,
        boxShadow: theme.shadows![4]
      }
    })
    const sizeSmall = (theme: Theme): Style => theme.sizes!.small!.button
    const sizeMedium = (theme: Theme): Style => theme.sizes!.medium!.button
    const sizeLarge = (theme: Theme): Style => theme.sizes!.large!.button
    const block = {
      width: '100%'
    }

    export const styles = (theme: Theme): Styles<ButtonClassProps> => ({
      root: root(theme),
      variantStandard: variantStandard(theme),
      variantPrimary: variantPrimary(theme),
      sizeSmall: sizeSmall(theme),
      sizeMedium: sizeMedium(theme),
      sizeLarge: sizeLarge(theme),
      block
    })