Added content warning dialog.

This commit is contained in:
DebaucheryLibrarian
2020-12-18 02:10:30 +01:00
parent 5e7741afe8
commit 5b16941ec5
3 changed files with 148 additions and 0 deletions

View File

@@ -3,6 +3,12 @@
class="container"
:class="theme"
>
<Warning
v-if="showWarning"
class="warning-container"
@enter="closeWarning"
/>
<transition name="slide">
<Sidebar
v-if="showSidebar"
@@ -23,6 +29,7 @@ import { mapState } from 'vuex';
import EventBus from '../../js/event-bus';
import Warning from './warning.vue';
import Header from '../header/header.vue';
import Sidebar from '../sidebar/sidebar.vue';
@@ -34,6 +41,11 @@ function toggleSidebar(state) {
this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar;
}
function closeWarning() {
this.showWarning = false;
sessionStorage.setItem('warning', 'warned');
}
function mounted() {
document.addEventListener('click', () => {
EventBus.$emit('blur');
@@ -44,10 +56,12 @@ export default {
components: {
Header,
Sidebar,
Warning,
},
data() {
return {
showSidebar: false,
showWarning: sessionStorage.getItem('warning') !== 'warned',
};
},
computed: {
@@ -58,6 +72,7 @@ export default {
mounted,
methods: {
toggleSidebar,
closeWarning,
},
};
</script>