blob: f5e6df92dd4517f3373790ff1bb32f0d5c1584fa [file] [log] [blame]
Yoshie Muranaka8d129102019-12-19 09:51:55 -08001<template>
Yoshie Muranakadb6fd252020-02-11 13:38:00 -08002 <div class="page-title">
Yoshie Muranaka8d129102019-12-19 09:51:55 -08003 <h1>{{ title }}</h1>
4 <p v-if="description">{{ description }}</p>
Yoshie Muranakadb6fd252020-02-11 13:38:00 -08005 </div>
Yoshie Muranaka8d129102019-12-19 09:51:55 -08006</template>
7
8<script>
kirankumarb0738e131a2023-02-07 15:21:52 +05309import i18n from '@/i18n';
Yoshie Muranaka8d129102019-12-19 09:51:55 -080010export default {
11 name: 'PageTitle',
Derick Montague09e45cd2020-01-23 15:45:57 -060012 props: {
13 description: {
14 type: String,
Derick Montague602e98a2020-10-21 16:20:00 -050015 default: '',
16 },
Derick Montague09e45cd2020-01-23 15:45:57 -060017 },
Yoshie Muranakac11d3892020-02-19 08:07:40 -080018 data() {
19 return {
Derick Montague602e98a2020-10-21 16:20:00 -050020 title: this.$route.meta.title,
Yoshie Muranakac11d3892020-02-19 08:07:40 -080021 };
Derick Montague602e98a2020-10-21 16:20:00 -050022 },
kirankumarb0738e131a2023-02-07 15:21:52 +053023 created() {
kirankumarb075d954182023-03-09 18:17:58 +053024 let title = this.$route.name;
25 let i = 1;
26 if (title) {
27 while (i < this.$route.name.split('-').length) {
28 let index = title.search('-');
29 title = title.replace(
30 '-' + title.charAt(index + 1),
31 title.charAt(index + 1).toUpperCase()
32 );
33 i++;
34 }
35 this.title = i18n.t('appPageTitle.' + title);
36 document.title = this.title;
kirankumarb0738e131a2023-02-07 15:21:52 +053037 }
kirankumarb0738e131a2023-02-07 15:21:52 +053038 },
Yoshie Muranaka8d129102019-12-19 09:51:55 -080039};
40</script>
41
42<style lang="scss" scoped>
Yoshie Muranaka8d129102019-12-19 09:51:55 -080043.page-title {
44 margin-bottom: $spacer * 2;
45}
Yoshie Muranaka8d129102019-12-19 09:51:55 -080046p {
47 max-width: 72ch;
48}
49</style>