fix(modal): nested modals should correctly toggle the body class (#1331)

Fixes #1324
This commit is contained in:
metonym 2022-06-02 17:56:07 -07:00 committed by GitHub
commit 22f93ee675
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 2 deletions

8
src/Modal/modalStore.js Normal file
View file

@ -0,0 +1,8 @@
import { writable } from "svelte/store";
export const modalsOpen = writable([]);
export const addModalId = (id) => modalsOpen.update((ids) => [...ids, id]);
export const removeModalId = (id) =>
modalsOpen.update((ids) => ids.filter((_id) => _id !== id));