Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 1 | <template> |
Yoshie Muranaka | db6fd25 | 2020-02-11 13:38:00 -0800 | [diff] [blame] | 2 | <div class="page-title"> |
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 3 | <h1>{{ title }}</h1> |
4 | <p v-if="description">{{ description }}</p> | ||||
Yoshie Muranaka | db6fd25 | 2020-02-11 13:38:00 -0800 | [diff] [blame] | 5 | </div> |
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 6 | </template> |
7 | |||||
8 | <script> | ||||
kirankumarb07 | 38e131a | 2023-02-07 15:21:52 +0530 | [diff] [blame] | 9 | import i18n from '@/i18n'; |
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 10 | export default { |
11 | name: 'PageTitle', | ||||
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 12 | props: { |
13 | description: { | ||||
14 | type: String, | ||||
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 15 | default: '', |
16 | }, | ||||
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 17 | }, |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 18 | data() { |
19 | return { | ||||
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 20 | title: this.$route.meta.title, |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 21 | }; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 22 | }, |
kirankumarb07 | 38e131a | 2023-02-07 15:21:52 +0530 | [diff] [blame] | 23 | created() { |
kirankumarb07 | 5d95418 | 2023-03-09 18:17:58 +0530 | [diff] [blame^] | 24 | 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; | ||||
kirankumarb07 | 38e131a | 2023-02-07 15:21:52 +0530 | [diff] [blame] | 37 | } |
kirankumarb07 | 38e131a | 2023-02-07 15:21:52 +0530 | [diff] [blame] | 38 | }, |
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 39 | }; |
40 | </script> | ||||
41 | |||||
42 | <style lang="scss" scoped> | ||||
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 43 | .page-title { |
44 | margin-bottom: $spacer * 2; | ||||
45 | } | ||||
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 46 | p { |
47 | max-width: 72ch; | ||||
48 | } | ||||
49 | </style> |