Pārlūkot izejas kodu

:sparkles: moved breadcumb to its own component

tags/0.9.0
j 4 gadus atpakaļ
vecāks
revīzija
a5f6773a22

+ 28
- 0
vue-theme/src/components/breadcrumb.vue Parādīt failu

1
+<template lang="pug">
2
+//- breadcrumb links at top of page, needs link routing
3
+.breadcrumb.f-row.start.t-up
4
+    router-link(v-if="['events','exhibitions'].includes(type)" :to="`/${type}/by-current-and-upcoming`")
5
+        h5.t-up {{ type }}
6
+    router-link(v-else :to="`/${type}`")
7
+        h5.t-up {{ type }}
8
+    h5 &#62;
9
+    router-link(:to="`/${type}/${post.slug}`")
10
+        h5 {{ post.title }}
11
+</template>
12
+
13
+<script>
14
+export default {
15
+    props: {
16
+        type: { type: String },
17
+        post: { type: Object }
18
+    }
19
+}
20
+</script>
21
+
22
+<style lang="postcss">
23
+@import '../sss/variables.sss'
24
+@import '../sss/theme.sss'
25
+.breadcrumb
26
+    h5
27
+        font-size: $ms--1
28
+</style>

+ 8
- 13
vue-theme/src/pages/single.vue Parādīt failu

8
     article(v-else).w-max.f-grow.shadow
8
     article(v-else).w-max.f-grow.shadow
9
         header
9
         header
10
             //- breadcrumb links at top of page, needs link routing
10
             //- breadcrumb links at top of page, needs link routing
11
-            breadcrumb.f-row.start.t-up
12
-                router-link(v-if="['events','exhibitions'].includes(type)" :to="`/${type}/by-current-and-upcoming`")
13
-                    h5.t-up {{ type }}
14
-                router-link(v-else :to="`/${type}`")
15
-                    h5.t-up {{ type }}
16
-                //- h5 &#8226;
17
-                h5 &#62;
18
-                router-link(:to="`/${type}/${post.slug}`")
19
-                    h5 {{ post.title }}
11
+            breadcrumb(:type="type" :post="post")
20
             
12
             
21
-            //- h1 {{ type }}:{{ $route.params.slug }} {{ post.title }}
22
             h1.t-b  {{ post.title }}
13
             h1.t-b  {{ post.title }}
23
             //- p(v-if="post.categories") categories: {{ post.categories }}
14
             //- p(v-if="post.categories") categories: {{ post.categories }}
24
             //- p(v-if="post.type") type: {{ post.type }}
15
             //- p(v-if="post.type") type: {{ post.type }}
52
 import sidebar from '@/components/sidebars/sidebar'
43
 import sidebar from '@/components/sidebars/sidebar'
53
 import gallery from '@/components/gallery/'
44
 import gallery from '@/components/gallery/'
54
 import credits from '@/components/credits'
45
 import credits from '@/components/credits'
46
+import breadcrumb from '@/components/breadcrumb'
55
 
47
 
56
 import { postTypeGetters, scrollTop } from './mixin-post-types'
48
 import { postTypeGetters, scrollTop } from './mixin-post-types'
57
 
49
 
58
 import { convertTitleCase, dePluralize, typeFromRoute } from '@/utils/helpers'
50
 import { convertTitleCase, dePluralize, typeFromRoute } from '@/utils/helpers'
59
  
51
  
60
 export default {
52
 export default {
61
-    components: { sidebar, gallery, credits, card },
53
+    components: { sidebar, gallery, credits, card, breadcrumb },
62
     props: {
54
     props: {
63
         sidebar: { type: Boolean },
55
         sidebar: { type: Boolean },
64
         id: { type: Number }
56
         id: { type: Number }
150
          * @param {object} posts
142
          * @param {object} posts
151
          */
143
          */
152
         checkAndSetHero(post) {
144
         checkAndSetHero(post) {
153
-            // console.log(post)
154
             if(!post) return
145
             if(!post) return
155
-            let json = { url: post.featured, heroType: 'image' }
146
+
147
+            const json = { url: post.featured, heroType: 'image' }
156
             if(post.hero && JSON.parse(post.hero) && JSON.parse(post.hero).url) {
148
             if(post.hero && JSON.parse(post.hero) && JSON.parse(post.hero).url) {
157
                 json = JSON.parse(post.hero)
149
                 json = JSON.parse(post.hero)
158
                 json.heroType = 'video'
150
                 json.heroType = 'video'
161
             if(!json.url) {
153
             if(!json.url) {
162
                 json.heroType = null
154
                 json.heroType = null
163
             }
155
             }
156
+            // Set the hero text to the post title
157
+            json.text = post.title
158
+            
164
             this.$store.commit('SET_HERO', json)
159
             this.$store.commit('SET_HERO', json)
165
         },
160
         },
166
         
161
         

Notiek ielāde…
Atcelt
Saglabāt