Popup had a problem when they need to be scroolable
This commit is contained in:
parent
fb88e97825
commit
a61ccea317
@ -14,15 +14,12 @@ interface Props {
|
|||||||
export default function Popup(props: Props): JSX.Element {
|
export default function Popup(props: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`fixed inset-0 z-50 grid place-content-center transition-[backdrop-filter] duration-500 ${
|
className={`fixed inset-0 z-50 grid place-content-center
|
||||||
|
transition-[backdrop-filter] duration-500 ${
|
||||||
props.state
|
props.state
|
||||||
? "[backdrop-filter:blur(2px)]"
|
? "[backdrop-filter:blur(2px)]"
|
||||||
: "pointer-events-none touch-none"
|
: "pointer-events-none touch-none"
|
||||||
}`}
|
}`}
|
||||||
onKeyUp={(event) => {
|
|
||||||
if (event.key.match("Escape")) props.setState(false);
|
|
||||||
}}
|
|
||||||
tabIndex={0}
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={`fixed bg-shade inset-0 transition-all duration-500 ${
|
className={`fixed bg-shade inset-0 transition-all duration-500 ${
|
||||||
@ -32,21 +29,20 @@ export default function Popup(props: Props): JSX.Element {
|
|||||||
props.setState(false);
|
props.setState(false);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={`p-10 grid gap-4 place-items-center transition-transform ${
|
className={`p-10 grid gap-4 place-items-center transition-transform ${
|
||||||
props.state ? "scale-100" : "scale-0"
|
props.state ? "scale-100" : "scale-0"
|
||||||
} ${props.fillViewport ? "absolute inset-10 top-20" : "relative"} ${
|
} ${
|
||||||
|
props.fillViewport
|
||||||
|
? "absolute inset-10 top-20"
|
||||||
|
: "relative max-h-[80vh] overflow-y-auto mobile:w-[85vw]"
|
||||||
|
} ${
|
||||||
props.hideBackground
|
props.hideBackground
|
||||||
? ""
|
? ""
|
||||||
: "bg-light rounded-lg shadow-2xl shadow-shade"
|
: "bg-light rounded-lg shadow-2xl shadow-shade"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Button
|
|
||||||
className="!p-1 absolute -top-16 bg-light border-light border-4"
|
|
||||||
onClick={() => props.setState(false)}
|
|
||||||
>
|
|
||||||
<span className="material-icons p-1">close</span>
|
|
||||||
</Button>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user