# All files / src/Table/components Head.tsx

100% Statements 16/16
100% Branches 0/0
100% Functions 1/1
100% Lines 15/15

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
    332x
    2x
    2x
    2x

    2x

    2x

    2x

    2x

    2x

    2x
    2x
    2x
    2x

    2x

    2x
     import * as React from 'react'
    import classNames from 'classnames'
    import { createUseStyles } from '@fluent-ui/styles'
    import { styles } from '../Table.styled'
    import { Theme } from '@fluent-ui/core/styles'
    import { TableContext, TableContextProps } from './TableContext'
    import { TableClassProps } from '../Table.type'

    const tableContext: TableContextProps = {
      variant: 'head'
    }

    export const name = 'TableHead'

    const useStyles = createUseStyles<Theme, TableClassProps>(styles, { name })

    const Head = React.forwardRef<HTMLTableElement, any>(
      (props, ref): React.ReactElement => {
        // eslint-disable-next-line react/prop-types
        const { className: classNameProp, ...rest } = props
        const classes = useStyles(props)
        const className = classNames(classes.headRoot, classNameProp)
        return (
          <TableContext.Provider value={tableContext}>
            <thead className={className} ref={ref} {...rest} />
          </TableContext.Provider>
        )
      }
    )
    Head.displayName = `F${name}`

    export default Head