# All files / src/styles createShadow.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

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

    30x
    30x

    150x

    30x

    30x
     import * as CSS from 'csstype'

    const keyUmbraOpacity = 0.132
    const keyPenumbraOpacity = 0.108

    function createShadow(...px: number[]): CSS.BoxShadowProperty {
      return [
        `${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${keyUmbraOpacity})`,
        `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${keyPenumbraOpacity})`
      ].join(',')
    }

    export type Shadows = CSS.BoxShadowProperty[]

    const shadows: Shadows = [
      'none',
      createShadow(0, 1.6, 3.6, 0, 0, 0.3, 0.9, 0),
      createShadow(0, 3.2, 7.2, 0, 0, 0.6, 1.8, 0),
      createShadow(0, 6.4, 14.4, 0, 0, 1.2, 3.6, 0),
      createShadow(0, 12.8, 28.8, 0, 0, 2.4, 7.2, 0),
      createShadow(0, 25.6, 57.6, 0, 0, 4.8, 14.4, 0)
    ]

    export default shadows