Skip to content
Snippets Groups Projects
Modal.tsx 914 B
Newer Older
  • Learn to ignore specific revisions
  • Hugo NOUTS's avatar
    Hugo NOUTS committed
    import React, { ReactNode } from 'react'
    import StyledIconButton from 'components/CommonKit/IconButton/StyledIconButton'
    import CloseIcon from 'assets/icons/ico/close.svg'
    
    interface ModalProps {
      open: boolean
      border?: boolean
      handleCloseClick: () => void
      children: ReactNode
    
    Romain CREY's avatar
    Romain CREY committed
      yellowBorder?: string
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    }
    
    const Modal: React.FC<ModalProps> = ({
      open,
      border,
      handleCloseClick,
      children,
    
    Romain CREY's avatar
    Romain CREY committed
      yellowBorder,
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    }: ModalProps) => {
    
      const yellow = yellowBorder ? yellowBorder : ''
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
      return (
        <div className={`modal-overlay ${open ? 'modal-opened' : ''}`}>
    
    Romain CREY's avatar
    Romain CREY committed
          <div
    
            className={`modal-box ${border ? 'modal-box-bordered' : ''} ${yellow}`}
    
    Romain CREY's avatar
    Romain CREY committed
          >
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
            <StyledIconButton
              className="modal-close-button"
              icon={CloseIcon}
              onClick={handleCloseClick}
            />
            <div className="modal-content">{children}</div>
          </div>
        </div>
      )
    }
    
    export default Modal