import React, { Fragment, PropsWithChildren, FunctionComponent } from 'react';

export interface WithLoaderProps {
  loading?: boolean
}

export const WithLoader: FunctionComponent<WithLoaderProps> = ({ loading, children }) => {
  return (
    <Fragment>
      {
        loading ?
        <div className="loader-container">
          <div className="lds-ripple">
            <div></div>
            <div></div>
          </div>
        </div> :
        children
      }
    </Fragment>
  )
}