Alert overlays should display over modals

We were using the same Overlay with no changes, so alerts would display over modals without an overlay behind them
This commit is contained in:
Justin Edmund 2023-07-02 16:18:13 -07:00
parent e43ecb2c00
commit c763a81e21
4 changed files with 15 additions and 7 deletions

View file

@ -7,7 +7,7 @@
width: 100vw;
top: 0;
left: 0;
z-index: 31;
z-index: 12;
}
.overlay {

View file

@ -22,6 +22,7 @@ const Alert = (props: Props) => {
<AlertDialog.Root open={props.open}>
<AlertDialog.Portal>
<Overlay
className="alert"
open={props.open}
visible={true}
onClick={props.cancelAction}

View file

@ -8,6 +8,10 @@
bottom: 0;
left: 0;
&.alert {
z-index: 11;
}
&.job {
animation: none;
backdrop-filter: blur(5px) saturate(100%) brightness(80%) opacity(1);

View file

@ -3,6 +3,7 @@ import classNames from 'classnames'
import styles from './index.module.scss'
interface Props {
className?: string
visible: boolean
open: boolean
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void
@ -13,15 +14,18 @@ const defaultProps = {
}
const Overlay = React.forwardRef<HTMLDivElement, Props>(function Overlay(
{ visible: displayed, open, onClick }: Props,
{ className, visible: displayed, open, onClick }: Props,
forwardedRef
) {
const [visible, setVisible] = useState(open)
const classes = classNames({
[styles.overlay]: true,
[styles.visible]: displayed,
})
const classes = classNames(
{
[styles.overlay]: true,
[styles.visible]: displayed,
},
className?.split(' ').map((c) => styles[c])
)
useEffect(() => {
if (!open) {
@ -38,7 +42,6 @@ const Overlay = React.forwardRef<HTMLDivElement, Props>(function Overlay(
function handleClick(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {
// event.stopPropagation()
console.log('Hey!')
if (onClick) onClick(event)
}