Parcourir la source

:recycle: moved card to separate component

tags/0.9.0
j il y a 4 ans
Parent
révision
822e7d2274
1 fichiers modifiés avec 25 ajouts et 84 suppressions
  1. 25
    84
      vue-theme/src/pages/index.vue

+ 25
- 84
vue-theme/src/pages/index.vue Voir le fichier

6
             ul.flipped(:class="[`sticky-${Object.keys(allSticky).length}`]")
6
             ul.flipped(:class="[`sticky-${Object.keys(allSticky).length}`]")
7
                 //- if sticky
7
                 //- if sticky
8
                 li.shadow(v-for="sticky in allSticky")
8
                 li.shadow(v-for="sticky in allSticky")
9
-                    .card(v-if="sticky")
10
-                        router-link(:to="`/${sticky.type}`")
11
-                            p.t-up {{sticky.type}}
12
-                        .card--info
13
-                            router-link(:to="`/${sticky.type}/${sticky.slug}`")
14
-                                img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
15
-                            .f-col.w-max
16
-                                router-link(:to="`/${sticky.type}/${sticky.slug}`")
17
-                                    h1.t-up.t-cntr {{ sticky.title }}
18
-                                p episode excerpt, Lorem ipsum dolor sit amet, consectetu
9
+                    card(:content="sticky" :type="`${sticky.type}s`")
19
 
10
 
20
         section
11
         section
21
             ul
12
             ul
22
                 li.shadow(v-for="type in ['episodes', 'exhibitions', 'events', 'artists', 'posts']")
13
                 li.shadow(v-for="type in ['episodes', 'exhibitions', 'events', 'artists', 'posts']")
23
-                    .card(v-if="firstPostOfType(type)")
24
-                        router-link(:to="`/${type}`")
25
-                            p.t-up {{type}}
26
-                        router-link(:to="`/${type}/${firstPostOfType(type).slug}`")
27
-                            img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
28
-                            h1.t-up.t-cntr {{ firstPostOfType(type).title }}
29
-                        p episode excerpt, Lorem ipsum dolor sit amet, consectetu
14
+                    card(:content="firstPostOfType(type)" :type="type")
30
 
15
 
31
         section.max
16
         section.max
32
             ul.w-max
17
             ul.w-max
33
                 li.shadow(v-for="post in [randomPostOfType('artists')]")
18
                 li.shadow(v-for="post in [randomPostOfType('artists')]")
34
-                    .card(v-if="post")
35
-                        router-link(:to="`/${'artists'}/${post.slug}`")
36
-                            p.t-up {{'artists'}}
37
-                        .card--info.f-row
38
-                            router-link(:to="`/artists/${post.slug}`")
39
-                                img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
40
-                            .f-col.w-max
41
-                                router-link(:to="`/artists/${post.slug}`")
42
-                                    h1.t-up.t-cntr {{ post.title }}
43
-                                p episode excerpt, Lorem ipsum dolor sit amet, consectetu
19
+                    card(v-if="post" :content="post" :type="`${post.type}s`" :wide="true")
44
 
20
 
45
         section
21
         section
46
             ul.flipped
22
             ul.flipped
47
                 li.shadow(v-for="type in ['episodes', 'exhibitions', 'events', 'artists', 'artists']")
23
                 li.shadow(v-for="type in ['episodes', 'exhibitions', 'events', 'artists', 'artists']")
48
                     .random--wrapper(v-for="post in [randomPostOfType(type)]")
24
                     .random--wrapper(v-for="post in [randomPostOfType(type)]")
49
-                        .card(v-if="post")
50
-                            router-link(:to="`/${type}`")
51
-                                p.t-up {{type}}
52
-                            router-link(:to="`/${type}/${post.slug}`")
53
-                                img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
54
-                                h1.t-up.t-cntr {{ post.title }}
55
-                            p episode excerpt, Lorem ipsum dolor sit amet, consectetu
56
-                                
57
-
25
+                        card(:content="post" :type="type")
58
 </template>
26
 </template>
59
 
27
 
60
 <script>
28
 <script>
61
 import { postTypeGetters, scrollTop } from './mixin-post-types'
29
 import { postTypeGetters, scrollTop } from './mixin-post-types'
30
+import card from '@/components/card.vue'
62
 
31
 
63
 import { convertTitleCase, postTypes } from '@/utils/helpers'
32
 import { convertTitleCase, postTypes } from '@/utils/helpers'
64
 
33
 
65
 export default {
34
 export default {
66
     mixins: [postTypeGetters, scrollTop],
35
     mixins: [postTypeGetters, scrollTop],
36
+    components: { card },
67
     created() {
37
     created() {
68
         // console.log(wp)
38
         // console.log(wp)
69
         postTypes.forEach(type => {
39
         postTypes.forEach(type => {
102
 <style lang="postcss">
72
 <style lang="postcss">
103
 @import '../sss/variables.sss'
73
 @import '../sss/variables.sss'
104
 @import '../sss/theme.sss'
74
 @import '../sss/theme.sss'
105
-.page--index
106
-    > article
107
-        display: flex
108
-        justify-content: space-around
109
-        flex-direction: column
110
-        align-items: stretch
111
-        section
112
-            ul
113
-                list-style: none
114
-                .card
115
-                    padding: $ms--3 $ms--1
116
-                    overflow: hidden
117
-                    text-overflow: clip
118
-                    &--info
119
-                        justify-content: center
120
-                    img
121
-                        width: 100%
122
-                        height: auto
123
-                    h1, h2, h3, p
124
-                        padding: 0
125
-                        margin: 0
126
-                    h1
127
-                        font-size: $ms-1
128
-            &.max 
129
-                margin: 0
130
-                > ul
131
-                    grid-template-columns: 
132
-                        auto
133
-                    grid-template-rows: 
134
-                        auto
135
-                    > li > .card > img
136
-                        width: 100%
75
+.page--index > article
76
+    display: flex
77
+    justify-content: space-around
78
+    flex-direction: column
79
+    align-items: stretch
80
+    section
81
+        ul
82
+            list-style: none
83
+            li
84
+                margin: 0 0 $ms-0 0
85
+        &.max 
86
+            margin: 0
87
+            > ul
88
+                grid-template-columns: 
89
+                    auto
90
+                grid-template-rows: 
91
+                    auto
137
 @media (min-width: $medium)
92
 @media (min-width: $medium)
138
     .page--index > article > section
93
     .page--index > article > section
139
         &.stickies
94
         &.stickies
140
             margin: 0 0 2% 0
95
             margin: 0 0 2% 0
141
         &.max 
96
         &.max 
142
             margin: 3.5% 0 3% 0
97
             margin: 3.5% 0 3% 0
143
-            > li .card--info > a:first-of-type
144
-                width: 100%
145
         ul
98
         ul
146
             display: grid
99
             display: grid
147
             grid-template-columns: 
100
             grid-template-columns: 
150
                 48% 48%
103
                 48% 48%
151
             gap: 4% 1%
104
             gap: 4% 1%
152
             li
105
             li
106
+                margin: 0
153
                 min-height: 10em
107
                 min-height: 10em
154
                 background-color: purple
108
                 background-color: purple
155
                 &:nth-of-type(1)
109
                 &:nth-of-type(1)
166
                     grid-row-start: 2
120
                     grid-row-start: 2
167
                 &:nth-of-type(5)
121
                 &:nth-of-type(5)
168
                     grid-column-start: 3
122
                     grid-column-start: 3
169
-                .card
170
-                    padding: $ms--3 $ms--1
171
-                    overflow: hidden
172
-                    text-overflow: clip
173
-                    &--info
174
-                        justify-content: center
175
-                    img
176
-                        width: 100%
177
-                        height: auto
178
-                    h1, h2, h3, p
179
-                        padding: 0
180
-                        margin: 0
181
-                    h1
182
-                        font-size: $ms-1
123
+
183
         &.stickies
124
         &.stickies
184
             ul
125
             ul
185
                 &.flipped
126
                 &.flipped

Chargement…
Annuler
Enregistrer