2022-01-24 21:16:50 +05:00
|
|
|
import { HTMLAttributes, ReactNode } from 'react'
|
|
|
|
|
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-01-24 21:16:50 +05:00
|
|
|
export const LoaderPortal: React.FC<LoaderPortalProps> = ({ show, fade = true, children, ...other }) => (
|
2021-12-07 19:36:25 +05:00
|
|
|
<div className={'loader-container'} {...other}>
|
|
|
|
<div className={'loader-content'}>{children}</div>
|
|
|
|
{show && fade && <div className={'loader-fade'}/>}
|
|
|
|
{show && <div className={'loader-overlay'}><Loader/></div>}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
export default LoaderPortal
|