asb_cloud_front/src/components/LoaderPortal.tsx

19 lines
540 B
TypeScript
Raw Normal View History

2022-01-25 02:00:07 +05:00
import { HTMLAttributes } from 'react'
import Loader from './Loader'
type LoaderPortalProps = HTMLAttributes<HTMLDivElement> & {
show?: boolean,
fade?: boolean,
}
export const LoaderPortal: React.FC<LoaderPortalProps> = ({ show, fade = true, children, ...other }) => (
<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