Portal/rsconcept/frontend/src/components/Container/Overlay.tsx

34 lines
693 B
TypeScript
Raw Normal View History

2024-06-07 20:17:03 +03:00
import clsx from 'clsx';
import { CProps } from '../props';
2024-06-07 20:17:03 +03:00
interface OverlayProps extends CProps.Styling {
/** Id of the overlay. */
2024-06-07 20:17:03 +03:00
id?: string;
/** Classnames for position of the overlay. */
2024-06-07 20:17:03 +03:00
position?: string;
/** Classname for z-index of the overlay. */
2024-06-07 20:17:03 +03:00
layer?: string;
}
/**
* Displays a transparent overlay over the main content.
*/
2025-02-07 10:53:49 +03:00
export function Overlay({
2024-09-19 17:48:48 +03:00
children,
className,
position = 'top-0 right-0',
layer = 'z-pop',
...restProps
}: React.PropsWithChildren<OverlayProps>) {
2024-06-07 20:17:03 +03:00
return (
<div className='relative'>
<div className={clsx('absolute', className, position, layer)} {...restProps}>
{children}
</div>
</div>
);
}