Bläddra i källkod

:sparkles: moved breadcumb to its own component

tags/0.9.0
j 4 år sedan
förälder
incheckning
a5f6773a22
2 ändrade filer med 36 tillägg och 13 borttagningar
  1. 28
    0
      vue-theme/src/components/breadcrumb.vue
  2. 8
    13
      vue-theme/src/pages/single.vue

+ 28
- 0
vue-theme/src/components/breadcrumb.vue Visa fil

@@ -0,0 +1,28 @@
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 Visa fil

@@ -8,17 +8,8 @@
8 8
     article(v-else).w-max.f-grow.shadow
9 9
         header
10 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 13
             h1.t-b  {{ post.title }}
23 14
             //- p(v-if="post.categories") categories: {{ post.categories }}
24 15
             //- p(v-if="post.type") type: {{ post.type }}
@@ -52,13 +43,14 @@ import card from '@/components/card.vue'
52 43
 import sidebar from '@/components/sidebars/sidebar'
53 44
 import gallery from '@/components/gallery/'
54 45
 import credits from '@/components/credits'
46
+import breadcrumb from '@/components/breadcrumb'
55 47
 
56 48
 import { postTypeGetters, scrollTop } from './mixin-post-types'
57 49
 
58 50
 import { convertTitleCase, dePluralize, typeFromRoute } from '@/utils/helpers'
59 51
  
60 52
 export default {
61
-    components: { sidebar, gallery, credits, card },
53
+    components: { sidebar, gallery, credits, card, breadcrumb },
62 54
     props: {
63 55
         sidebar: { type: Boolean },
64 56
         id: { type: Number }
@@ -150,9 +142,9 @@ export default {
150 142
          * @param {object} posts
151 143
          */
152 144
         checkAndSetHero(post) {
153
-            // console.log(post)
154 145
             if(!post) return
155
-            let json = { url: post.featured, heroType: 'image' }
146
+
147
+            const json = { url: post.featured, heroType: 'image' }
156 148
             if(post.hero && JSON.parse(post.hero) && JSON.parse(post.hero).url) {
157 149
                 json = JSON.parse(post.hero)
158 150
                 json.heroType = 'video'
@@ -161,6 +153,9 @@ export default {
161 153
             if(!json.url) {
162 154
                 json.heroType = null
163 155
             }
156
+            // Set the hero text to the post title
157
+            json.text = post.title
158
+            
164 159
             this.$store.commit('SET_HERO', json)
165 160
         },
166 161
         

Laddar…
Avbryt
Spara