blob: e195d1acbf6a5cdf2386eb64a6198fe0788668b3 [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() {
24 var title = this.$route.name;
25 var i = 1;
26 while (i < this.$route.name.split('-').length) {
27 var index = title.search('-');
28 title = title.replace(
29 '-' + title.charAt(index + 1),
30 title.charAt(index + 1).toUpperCase()
31 );
32 i++;
33 }
34 this.title = i18n.t('appPageTitle.' + title);
35 document.title = this.title;
36 },
Yoshie Muranaka8d129102019-12-19 09:51:55 -080037};
38</script>
39
40<style lang="scss" scoped>
Yoshie Muranaka8d129102019-12-19 09:51:55 -080041.page-title {
42 margin-bottom: $spacer * 2;
43}
Yoshie Muranaka8d129102019-12-19 09:51:55 -080044p {
45 max-width: 72ch;
46}
47</style>