blob: 0b78e5b140855ee0d8a75347b2af70568344e01b [file] [log] [blame]
Derick Montaguee080a1a2019-12-04 16:30:08 -06001<template>
Yoshie Muranaka74f86872020-02-10 12:28:37 -08002 <div class="app-container">
kennyneedsmilky14172d72021-11-10 15:26:07 -06003 <app-header
4 ref="focusTarget"
5 class="app-header"
6 :router-key="routerKey"
7 @refresh="refresh"
8 />
Yoshie Muranaka74f86872020-02-10 12:28:37 -08009 <app-navigation class="app-navigation" />
10 <page-container class="app-content">
11 <router-view ref="routerView" :key="routerKey" />
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060012 <!-- Scroll to top button -->
13 <button-back-to-top />
Yoshie Muranaka74f86872020-02-10 12:28:37 -080014 </page-container>
Derick Montaguee080a1a2019-12-04 16:30:08 -060015 </div>
16</template>
17
18<script>
Derick Montaguee2fd1562019-12-20 13:26:53 -060019import AppHeader from '@/components/AppHeader';
20import AppNavigation from '@/components/AppNavigation';
SurenNeware61859092020-10-01 09:37:32 +053021import PageContainer from '@/components/Global/PageContainer';
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060022import ButtonBackToTop from '@/components/Global/ButtonBackToTop';
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050023import JumpLinkMixin from '@/components/Mixins/JumpLinkMixin';
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060024
Derick Montaguee080a1a2019-12-04 16:30:08 -060025export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -060026 name: 'App',
Derick Montaguee080a1a2019-12-04 16:30:08 -060027 components: {
28 AppHeader,
Yoshie Muranaka8d129102019-12-19 09:51:55 -080029 AppNavigation,
Derick Montague602e98a2020-10-21 16:20:00 -050030 PageContainer,
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060031 ButtonBackToTop,
Derick Montague75b48322019-12-06 01:24:41 -060032 },
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050033 mixins: [JumpLinkMixin],
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080034 data() {
35 return {
Derick Montague602e98a2020-10-21 16:20:00 -050036 routerKey: 0,
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080037 };
38 },
Derick Montague75b48322019-12-06 01:24:41 -060039 watch: {
Derick Montague602e98a2020-10-21 16:20:00 -050040 $route: function () {
Derick Montague602e98a2020-10-21 16:20:00 -050041 this.$nextTick(function () {
Derick Montague80267972021-02-16 09:47:03 -060042 this.setFocus(this.$refs.focusTarget.$el);
Derick Montague75b48322019-12-06 01:24:41 -060043 });
Derick Montague602e98a2020-10-21 16:20:00 -050044 },
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080045 },
Yoshie Muranaka6f712842021-02-04 11:23:03 -080046 mounted() {
47 this.$root.$on('refresh-application', () => this.refresh());
48 },
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080049 methods: {
50 refresh() {
51 // Changing the component :key value will trigger
52 // a component re-rendering and 'refresh' the view
53 this.routerKey += 1;
Derick Montague602e98a2020-10-21 16:20:00 -050054 },
55 },
Derick Montaguee080a1a2019-12-04 16:30:08 -060056};
57</script>
58
59<style lang="scss" scoped>
Yoshie Muranaka74f86872020-02-10 12:28:37 -080060.app-container {
61 display: grid;
62 grid-template-columns: 100%;
63 grid-template-rows: auto;
64 grid-template-areas:
65 'header'
66 'content';
67
68 @include media-breakpoint-up($responsive-layout-bp) {
69 grid-template-columns: $navigation-width 1fr;
70 grid-template-areas:
71 'header header'
72 'navigation content';
73 }
74}
75
76.app-header {
77 grid-area: header;
78 position: sticky;
79 top: 0;
80 z-index: $zindex-fixed + 1;
81}
82
83.app-navigation {
84 grid-area: navigation;
85}
86
87.app-content {
88 grid-area: content;
89 background-color: $white;
Derick Montaguee080a1a2019-12-04 16:30:08 -060090}
91</style>