2023-12-28 14:04:44 +03:00
|
|
|
import clsx from 'clsx';
|
2023-12-18 19:42:27 +03:00
|
|
|
|
2025-01-28 23:23:42 +03:00
|
|
|
import { CProps } from '@/components/props';
|
2023-12-18 19:42:27 +03:00
|
|
|
|
|
|
|
interface OverlayProps extends CProps.Styling {
|
2024-11-21 15:09:51 +03:00
|
|
|
/** Id of the overlay. */
|
2023-12-28 14:04:44 +03:00
|
|
|
id?: string;
|
2024-11-21 15:09:51 +03:00
|
|
|
|
|
|
|
/** Classnames for position of the overlay. */
|
2023-12-28 14:04:44 +03:00
|
|
|
position?: string;
|
2024-11-21 15:09:51 +03:00
|
|
|
|
|
|
|
/** Classname for z-index of the overlay. */
|
2023-12-28 14:04:44 +03:00
|
|
|
layer?: string;
|
2023-12-05 01:22:44 +03:00
|
|
|
}
|
|
|
|
|
2024-11-21 15:09:51 +03:00
|
|
|
/**
|
|
|
|
* Displays a transparent overlay over the main content.
|
|
|
|
*/
|
2024-09-19 17:49:25 +03:00
|
|
|
function Overlay({
|
|
|
|
children,
|
|
|
|
className,
|
|
|
|
position = 'top-0 right-0',
|
|
|
|
layer = 'z-pop',
|
|
|
|
...restProps
|
|
|
|
}: React.PropsWithChildren<OverlayProps>) {
|
2023-12-05 01:22:44 +03:00
|
|
|
return (
|
2023-12-28 14:04:44 +03:00
|
|
|
<div className='relative'>
|
|
|
|
<div className={clsx('absolute', className, position, layer)} {...restProps}>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2023-12-05 01:22:44 +03:00
|
|
|
}
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
export default Overlay;
|