-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modals now have a z-index from 8999 to 8000
- Loading branch information
1 parent
20d684b
commit 7a994f1
Showing
6 changed files
with
100 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Modal from "@/core/components/modals/modal.vue"; | ||
|
||
import { rootStore } from "@/store"; | ||
import { getModule, Module, Mutation, VuexModule } from "vuex-module-decorators"; | ||
|
||
@Module({ dynamic: true, store: rootStore, name: "modals", namespaced: true }) | ||
class ModalsStore extends VuexModule { | ||
modals: Modal[] = []; | ||
|
||
get topModal(): Modal { | ||
return this.modals[0]; | ||
} | ||
|
||
@Mutation | ||
setTopModal(modal: Modal): void { | ||
// Dont bother doing anything if the chosen modal is already at the top | ||
if (this.topModal === modal) return; | ||
// Put the chosen modal at the start of the array, and remove it from the rest of the list if exists | ||
this.modals = [modal, ...this.modals.filter(item => item !== modal).slice(0, 999)]; | ||
this.modals.forEach((element: Modal, i: number) => { | ||
element.$data.zIndex = 8999 - i; | ||
}); | ||
} | ||
|
||
@Mutation | ||
removeFromModals(modal: Modal): void { | ||
this.modals = this.modals.filter(item => item !== modal); | ||
} | ||
} | ||
|
||
export const modalsStore = getModule(ModalsStore); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters