Files
Tarokka/components/Scrim.tsx
gavin 5444e25249 stack-the-deck (#1)
Allow for redrawing or explicitly selecting a card for replacement.

Co-authored-by: Gavin McDonald <gavinmcdoh@gmail.com>
Reviewed-on: #1
2025-06-13 07:38:51 -04:00

28 lines
595 B
TypeScript

'use client';
type ScrimProps = {
children: React.ReactNode;
clickAction: (event: React.MouseEvent<HTMLDivElement>) => void;
show?: boolean;
className?: string;
};
export default function Scrim({ children, clickAction, show = true, className = '' }: ScrimProps) {
const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {
if (event.target === event.currentTarget) {
clickAction(event);
}
};
if (!show) return null;
return (
<div
onClick={handleClick}
className={`fixed inset-0 bg-black/20 backdrop-blur-sm z-40 ${className}`}
>
{children}
</div>
);
}