blob: 41b2e4431c623948f34586b19ea42e6dd34a61a7 [file] [log] [blame]
Derick Montaguee080a1a2019-12-04 16:30:08 -06001<template>
Yoshie Muranaka74f86872020-02-10 12:28:37 -08002 <div class="app-container">
3 <app-header ref="focusTarget" class="app-header" @refresh="refresh" />
4 <app-navigation class="app-navigation" />
5 <page-container class="app-content">
6 <router-view ref="routerView" :key="routerKey" />
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -06007 <!-- Scroll to top button -->
8 <button-back-to-top />
Yoshie Muranaka74f86872020-02-10 12:28:37 -08009 </page-container>
Derick Montaguee080a1a2019-12-04 16:30:08 -060010 </div>
11</template>
12
13<script>
Derick Montaguee2fd1562019-12-20 13:26:53 -060014import AppHeader from '@/components/AppHeader';
15import AppNavigation from '@/components/AppNavigation';
SurenNeware61859092020-10-01 09:37:32 +053016import PageContainer from '@/components/Global/PageContainer';
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060017import ButtonBackToTop from '@/components/Global/ButtonBackToTop';
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050018import JumpLinkMixin from '@/components/Mixins/JumpLinkMixin';
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060019
Derick Montaguee080a1a2019-12-04 16:30:08 -060020export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -060021 name: 'App',
Derick Montaguee080a1a2019-12-04 16:30:08 -060022 components: {
23 AppHeader,
Yoshie Muranaka8d129102019-12-19 09:51:55 -080024 AppNavigation,
Derick Montague602e98a2020-10-21 16:20:00 -050025 PageContainer,
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060026 ButtonBackToTop,
Derick Montague75b48322019-12-06 01:24:41 -060027 },
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050028 mixins: [JumpLinkMixin],
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080029 data() {
30 return {
Derick Montague602e98a2020-10-21 16:20:00 -050031 routerKey: 0,
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080032 };
33 },
Derick Montague75b48322019-12-06 01:24:41 -060034 watch: {
Derick Montague602e98a2020-10-21 16:20:00 -050035 $route: function () {
Derick Montague602e98a2020-10-21 16:20:00 -050036 this.$nextTick(function () {
Derick Montague80267972021-02-16 09:47:03 -060037 this.setFocus(this.$refs.focusTarget.$el);
Derick Montague75b48322019-12-06 01:24:41 -060038 });
Derick Montague602e98a2020-10-21 16:20:00 -050039 },
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080040 },
Yoshie Muranaka6f712842021-02-04 11:23:03 -080041 mounted() {
42 this.$root.$on('refresh-application', () => this.refresh());
43 },
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080044 methods: {
45 refresh() {
46 // Changing the component :key value will trigger
47 // a component re-rendering and 'refresh' the view
48 this.routerKey += 1;
Derick Montague602e98a2020-10-21 16:20:00 -050049 },
50 },
Derick Montaguee080a1a2019-12-04 16:30:08 -060051};
52</script>
53
54<style lang="scss" scoped>
Yoshie Muranaka74f86872020-02-10 12:28:37 -080055.app-container {
56 display: grid;
57 grid-template-columns: 100%;
58 grid-template-rows: auto;
59 grid-template-areas:
60 'header'
61 'content';
62
63 @include media-breakpoint-up($responsive-layout-bp) {
64 grid-template-columns: $navigation-width 1fr;
65 grid-template-areas:
66 'header header'
67 'navigation content';
68 }
69}
70
71.app-header {
72 grid-area: header;
73 position: sticky;
74 top: 0;
75 z-index: $zindex-fixed + 1;
76}
77
78.app-navigation {
79 grid-area: navigation;
80}
81
82.app-content {
83 grid-area: content;
84 background-color: $white;
Derick Montaguee080a1a2019-12-04 16:30:08 -060085}
86</style>