# All files / src/Panel Panel.styles.ts

100% Statements 34/34
80% Branches 32/40
100% Functions 6/6
100% Lines 31/31

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
    1183x
    3x
    3x
    3x
    3x
    3x
    3x

    3x
    3x

    3x

    3x

    3x

    3x

    3x

    1x
    1x
    1x

    1x
    1x

    3x

    3x

    3x

    3x

    1x
    1x

    3x

    3x

    3x

    3x

    1x
    1x

     import styled, { css } from 'styled-components'
    import { Card } from '../Card/Card'
    import { StyledSection, StyledSectionInner } from '../Section/Section.styles'
    import { Typography } from '../Typography/Typography'
    import { colors } from '../_styles/colors'
    import { getShadow } from '../_styles/shadows'
    import { spacing } from '../_styles/spacing'

    const headerActionSize = 36
    const buttonShadowWidth = 2

    const gutter = css`
      > * + * {
        margin-left: ${spacing.sm}px;
      }
    `

    const panel = css`
      display: flex;
      align-items: center;
      padding: ${spacing.lg}px;
      background: ${colors.white};
    `

    export const StyledHeader = styled.div`
      border-bottom: 1px solid ${colors.gray85};

      ${panel}
    `

    export const StyledTitle = styled(Typography)`
      flex-grow: 1;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    `

    export const StyledHeaderBackAction = styled.div<{ active: boolean }>`
      transition: all 300ms ease-out;
      flex-shrink: 0;

      width: ${({ active }) => (active ? headerActionSize : 0)}px;
      margin-right: ${({ active }) => (active ? spacing.lg : 0)}px;
      opacity: ${({ active }) => (active ? 1 : 0)};
      transform: translateX(
        ${({ active }) =>
          active ? 0 : -(spacing.lg + headerActionSize + buttonShadowWidth)}px
      );
    `

    export const StyledMoreMenu = styled(Card)`
      max-height: 128px;
    `

    export const StyledHeaderActions = styled.div`
      display: flex;
      margin-left: ${spacing.lg}px;
      flex-shrink: 0;

      ${gutter}
    `

    export const StyledCloseButton = styled.div`
      margin-left: ${spacing.sm}px;
    `

    export const StyledBody = styled.div<{ secondaryBgColor?: boolean }>`
      height: 100%;
      background: ${({ secondaryBgColor }) =>
        secondaryBgColor ? colors.gray96 : colors.white};
      overflow-y: auto;

      > ${StyledSection} {
        padding-left: ${spacing.lg}px;
        padding-right: ${spacing.lg}px;

        ${StyledSection} {
          padding-left: 0;
          padding-right: 0;
        }

        &:first-child > ${StyledSectionInner} {
          padding-top: ${spacing.lg}px;
        }
      }
    `

    export const StyledPanel = styled.aside`
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 100%;
      background: ${colors.white};
      overflow: hidden;
    `

    export const StyledFooterNotation = styled.div`
      flex-grow: 1;
    `

    export const StyledFooterActions = styled.div`
      ${gutter}
    `

    export const StyledFooter = styled.div<{ $hasShadow: boolean }>`
      border-top: 1px solid ${colors.gray85};
      justify-content: flex-end;

      ${panel}

      ${({ $hasShadow }) =>
        $hasShadow &&
        css`
          ${getShadow(2, 'top')}
          z-index: 1;
        `}
    `