2022-01-25 02:00:07 +05:00
|
|
|
import { HTMLAttributes } from 'react'
|
2022-01-24 21:16:50 +05:00
|
|
|
|
2022-02-25 16:57:08 +05:00
|
|
|
import { Loader } from '@components/icons'
|
2021-12-07 19:36:25 +05:00
|
|
|
|
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-25 16:57:08 +05:00
|
|
|
spinnerProps?: HTMLAttributes<HTMLDivElement>,
|
2021-12-07 19:36:25 +05:00
|
|
|
}
|
|
|
|
|
2022-06-25 15:46:20 +05:00
|
|
|
export const LoaderPortal: React.FC<LoaderPortalProps> = ({ className = '', show, fade = true, children, spinnerProps, ...other }) => (
|
2022-02-24 15:42:26 +05:00
|
|
|
<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'}/>}
|
2022-02-25 16:57:08 +05:00
|
|
|
{show && <div className={'loader-overlay'}><Loader {...spinnerProps} /></div>}
|
2021-12-07 19:36:25 +05:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
export default LoaderPortal
|