# All files / src/Item Item.styled.ts

100% Statements 17/17
100% Branches 0/0
100% Functions 6/6
100% Lines 11/11

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
    96
    97
    98
    99
    100
    101
    102
    103
    104

    21x

    21x

    21x

    7x

    7x

    21x

    21x

    7x

    7x

    7x

    21x

     import { Style, Styles } from 'jss'
    import { Theme } from '../styles'
    import { ItemClassProps } from './Item.type'

    const root = (theme: Theme): Style => ({
      position: 'relative',
      cursor: 'pointer',
      textDecoration: 'none',
      minHeight: 40,
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center',
      padding: '12px 20px',
      transition: theme.transitions!.default,
      color: 'inherit',
      backgroundColor: 'transparent',
      '&:hover': {
        backgroundColor: theme.colors!.standard!.transparent1
      },
      '&:active': {
        color: theme.colors!.black!.default,
        backgroundColor: theme.colors!.standard!.transparent2
      }
    })
    const reveal = (theme: Theme): Style => ({
      backgroundColor: theme.colors!.standard!.light2,
      '&:hover': {
        backgroundColor: theme.colors!.standard!.light1
      },
      '&:active': {
        backgroundColor: theme.colors!.standard!.dark1
      }
    })

    const activeBar = (theme: Theme): Style => ({
      position: 'absolute',
      backgroundColor: theme.colors!.primary!.default,
      transition: theme.transitions!.default,
      // horizontal false
      width: 6,
      height: 24,
      left: 0,
      top: '50%',
      marginTop: -12,
      // active false
      transform: 'scale3d(0, 0, 0)'
    })
    const activeBarHorizontal: Style = {
      // horizontal false
      width: '80%',
      height: 4,
      left: '10%',
      top: 'auto',
      bottom: 0
    }
    const activeBarActive: Style = {
      transform: 'scale3d(1, 1, 1)'
    }

    const prefixRoot = (theme: Theme): Style => ({
      height: '100%',
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center',
      transition: theme.transitions!.default
    })

    const text = (theme: Theme): Style => ({
      flex: 1,
      display: 'flex',
      alignItems: 'center',
      overflow: 'hidden',
      whiteSpace: 'nowrap',
      fontSize: 14,
      transition: theme.transitions!.default,
      // expanded false
      width: 0,
      opacity: 0,
      paddingLeft: 0
    })
    const textExpanded: Style = {
      width: 'auto',
      opacity: 1
    }
    const textNoChildren: Style = {
      paddingLeft: '0 !important'
    }
    const textHasPrefix: Style = {
      paddingLeft: 12
    }

    export const styles = (theme: Theme): Styles<ItemClassProps> => ({
      root: root(theme),
      reveal: reveal(theme),
      activeBar: activeBar(theme),
      activeBarHorizontal,
      activeBarActive,
      prefixRoot: prefixRoot(theme),
      text: text(theme),
      textExpanded,
      textNoChildren,
      textHasPrefix
    })