# All files / src/ListPage ListPage.tsx

100% Statements 45/45
100% Branches 12/12
100% Functions 7/7
100% Lines 36/36

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
    126
    127
    1282x
    2x

    2x

    2x
    2x
    2x

    2x
    1x

    1x

    2x
    2x

    2x

    2x
    1x
    1x

    2x
    2x
    2x

    2x
    1x

    1x

    2x

    4x
    4x
    4x
    4x
    4x
    4x

    4x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

     import React from 'react'
    import { addSubcomponents } from '../_utils/addSubcomponents'
    import { Props } from '../_utils/types'
    import {
      StyledListPage,
      StyledListPageBanner,
      StyledListPageBody,
      StyledListPageBodyContent,
      StyledListPageContentControls,
      StyledListPageControl,
      StyledListPageMain,
      StyledListPageToolHeader,
    } from './ListPage.styles'
    import { ListPageControlProps, ListPageProps } from './ListPage.types'

    export const ListPage_ = React.forwardRef<HTMLDivElement, ListPageProps>(
      function ListPage({ children, ...props }, ref) {
        return (
          <StyledListPage {...props} ref={ref}>
            {children}
          </StyledListPage>
        )
      }
    )

    export const Main = React.forwardRef<HTMLDivElement, Props>(function Main(
      { children, ...props },
      ref
    ) {
      return (
        <StyledListPageMain {...props} ref={ref}>
          {children}
        </StyledListPageMain>
      )
    })

    export const Banner = React.forwardRef<HTMLDivElement, Props>(function Banner(
      { children, ...props },
      ref
    ) {
      return (
        <StyledListPageBanner {...props} ref={ref}>
          {children}
        </StyledListPageBanner>
      )
    })

    export const ToolHeader = React.forwardRef<HTMLDivElement, Props>(
      function ToolHeader({ children, ...props }, ref) {
        return (
          <StyledListPageToolHeader {...props} ref={ref}>
            {children}
          </StyledListPageToolHeader>
        )
      }
    )

    export const ContentControls = React.forwardRef<HTMLDivElement, Props>(
      function ContentControls({ children, ...props }, ref) {
        return (
          <StyledListPageContentControls {...props} ref={ref}>
            {children}
          </StyledListPageContentControls>
        )
      }
    )

    export const Body = React.forwardRef<HTMLDivElement, Props>(function Body(
      { children, ...props },
      ref
    ) {
      return (
        <StyledListPageBody {...props} ref={ref}>
          <StyledListPageBodyContent>{children}</StyledListPageBodyContent>
        </StyledListPageBody>
      )
    })

    export const Control = React.forwardRef<HTMLDivElement, ListPageControlProps>(
      function Control(
        {
          alignRight = false,
          block = false,
          children,
          search = false,
          variant,
          ...props
        },
        ref
      ) {
        return (
          <StyledListPageControl
            {...props}
            $alignRight={alignRight || variant === 'align-right'}
            $block={block || variant === 'block'}
            $search={search || variant === 'search'}
            ref={ref}
          >
            {children}
          </StyledListPageControl>
        )
      }
    )

    Banner.displayName = 'ListPage.Banner'

    Body.displayName = 'ListPage.Body'

    ContentControls.displayName = 'ListPage.ContentControls'

    Control.displayName = 'ListPage.Control'

    Main.displayName = 'ListPage.Main'

    ToolHeader.displayName = 'ListPage.ToolHeader'

    export const ListPage = addSubcomponents(
      {
        Banner,
        Body,
        ContentControls,
        Control,
        Main,
        ToolHeader,
      },
      ListPage_
    )