# All files / Box Box.styled.ts

0% Statements 0/13
0% Branches 0/3
0% Functions 0/4
0% Lines 0/12

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
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125

     import {
      space,
      color,
      typography,
      layout,
      background,
      border,
      position,
      shadow,
      flexbox,
      grid,
      compose,
      breakpoints,
      themeGet
    } from '@fluent-ui/styles'
    import { Styles, Style } from 'jss'
    import { Theme } from '../styles'
    import { BoxClassProps, BoxProps } from './Box.type'

    const base = {
      '-webkit-overflow-scrolling': 'touch'
    }

    const mosaic =
      'data:image/png;base64, '

    const breakpoint = (theme: Theme): Style =>
      breakpoints({
        sm: {
          '&::-webkit-scrollbar': {
            width: 8,
            background: 'transparent'
          },
          '&::-webkit-scrollbar-thumb': {
            borderRadius: 8,
            backgroundColor: theme.colors!.standard!.transparent2,
            '&:hover': {
              backgroundColor: theme.colors!.standard!.transparent3
            }
          }
        }
      })

    const system = compose(
      space,
      color,
      typography,
      layout,
      background,
      border,
      position,
      shadow,
      flexbox,
      grid
    )

    const acrylic = (theme: Theme): ((props: BoxProps) => Style) => (props: BoxProps): Style => {
      const bg = (props.backgroundColor || props.background || props.bg) as string
      const themeBg = themeGet(`colors.${bg}`, bg)(theme)
      return {
        position: 'relative',
        overflow: 'hidden',
        '@supports ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)))': {
          background: 'none !important',
          backdropFilter: 'blur(10px)',
          '&::before, &::after': {
            content: `''`,
            position: 'absolute',
            left: 0,
            right: 0,
            top: 0,
            bottom: 0
          },
          '&::before': {
            zIndex: -2,
            opacity: 0.5,
            backgroundColor: themeBg
          },
          '&::after': {
            zIndex: -1,
            opacity: 0.25,
            backgroundImage: `url(${mosaic})`
          }
        },
        '@supports (not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))))': {
          background: 'inherit',
          zIndex: 1,
          '&::before': {
            background: 'inherit',
            filter: 'blur(10px)',
            content: `''`,
            position: 'absolute',
            left: -10,
            top: -10,
            width: 'calc(100% + 20px)',
            height: 'calc(100% + 20px)',
            zIndex: -1
          },
          '&::after': {
            content: `''`,
            position: 'absolute',
            left: 0,
            top: 0,
            right: 0,
            bottom: 0,
            zIndex: -1,
            opacity: 0.5,
            backgroundColor: themeBg,
            backgroundImage: `url(${mosaic})`
          }
        }
      }
    }

    export const styles = (theme: Theme): Styles<BoxClassProps> => {
      return {
        root: {
          ...base,
          ...breakpoint(theme)
        },
        system,
        acrylic: acrylic(theme)
      }
    }