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() { |
| 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 Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 37 | }; |
| 38 | </script> |
| 39 | |
| 40 | <style lang="scss" scoped> |
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 41 | .page-title { |
| 42 | margin-bottom: $spacer * 2; |
| 43 | } |
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 44 | p { |
| 45 | max-width: 72ch; |
| 46 | } |
| 47 | </style> |