2022-01-25 02:00:07 +05:00
|
|
|
import { HTMLAttributes } from 'react'
|
2022-01-24 21:16:50 +05:00
|
|
|
|
2021-12-07 19:36:25 +05:00
|
|
|
import Loader from './Loader'
|
|
|
|
|
2022-01-24 21:16:50 +05:00
|
|
|
type LoaderPortalProps = HTMLAttributes<HTMLDivElement> & {
|
2021-12-07 19:36:25 +05:00
|
|
|
show?: boolean,
|
|
|
|
fade?: boolean,
|
|
|
|
}
|
|
|
|
|
2022-02-24 15:42:26 +05:00
|
|
|
export const LoaderPortal: React.FC<LoaderPortalProps> = ({ className, show, fade = true, children, ...other }) => (
|
|
|
|
<div className={`loader-container ${className}`} {...other}>
|
2021-12-07 19:36:25 +05:00
|
|
|
<div className={'loader-content'}>{children}</div>
|
|
|
|
{show && fade && <div className={'loader-fade'}/>}
|
|
|
|
{show && <div className={'loader-overlay'}><Loader/></div>}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
export default LoaderPortal
|