1
0
Fork 0

feat(shared): Allow links to break out of modal

This commit is contained in:
Joost De Cock 2024-01-08 07:22:32 +01:00
parent f3911707a5
commit b056f6170a
2 changed files with 13 additions and 2 deletions

View file

@ -80,7 +80,12 @@ export const DesignCard = ({ name, lineDrawing = false }) => {
<button
onClick={() =>
setModal(
<ModalWrapper flex="col" justify="top lg:justify-center" slideFrom="right">
<ModalWrapper
flex="col"
justify="top lg:justify-center"
slideFrom="right"
keepOpenOnClick
>
<h1>{t(`designs:${name}.t`)}</h1>
<DesignInfo design={name} modal />
</ModalWrapper>

View file

@ -57,7 +57,13 @@ export const ModalWrapper = ({
? `lg:opacity-0 ${slideClasses[slideFrom]} lg:translate-x-0 lg:translate-y-0`
: 'opacity-100 translate-none'
const stopClick = (evt) => evt.stopPropagation()
const stopClick = (evt) => {
/*
* Do not keep modal open for links (with a href)
* but do keep it open for buttons (like a new modal context)
*/
if (!evt.target.attributes.href) evt.stopPropagation()
}
return (
<div