# All files / src/FileSelect/FileExplorer FileExplorerModal.tsx

100% Statements 16/16
50% Branches 3/6
50% Functions 1/2
100% Lines 13/13

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
    384x
    4x

    4x
    4x

    4x

    4x

    32x
    32x
    32x
    32x
    32x

    32x

    32x

     import React from 'react'
    import { Modal } from '../../Modal/Modal'
    import { ModalProps } from '../../Modal/Modal.types'
    import { Portal } from '../../Portal/Portal'
    import { useScrollLock } from '../../_hooks/ScrollLock'
    import { DivAttributes } from '../../_utils/types'
    import { StyledModalContainer, StyledModalOverlay } from './FileExplorer.styles'

    function noop() {}

    export const FileExplorerModal = React.forwardRef<
      HTMLDivElement,
      ModalProps & DivAttributes
    >(function FileExplorerModal(
      {
        children,
        onClickOverlay = noop,
        open = false,
        placement = 'center',
        ...props
      },
      ref
    ) {
      useScrollLock(open)

      return (
        <Portal>
          <StyledModalOverlay $open={open} ref={ref}>
            <Modal.Scrim onClick={onClickOverlay} />

            <StyledModalContainer {...props} placement={placement}>
              <Modal.Content>{children}</Modal.Content>
            </StyledModalContainer>
          </StyledModalOverlay>
        </Portal>
      )
    })