Просмотр исходного кода

:recycle: rough re-layout of home page

tags/0.9.0
j 4 лет назад
Родитель
Сommit
9a474ad6ba
2 измененных файлов: 67 добавлений и 79 удалений
  1. 1
    0
      vue-theme/src/app.vue
  2. 66
    79
      vue-theme/src/pages/index.vue

+ 1
- 0
vue-theme/src/app.vue Просмотреть файл

@@ -34,6 +34,7 @@ html
34 34
         main 
35 35
             background-color: green
36 36
             width: 100%
37
+            margin: 0 0 3vh 0
37 38
             
38 39
             :--headings
39 40
                 color: yellow

+ 66
- 79
vue-theme/src/pages/index.vue Просмотреть файл

@@ -4,35 +4,40 @@
4 4
     article.w-max
5 5
         section
6 6
             ul
7
-                li.wide
8
-                    p 1 - 1
9
-                li
10
-                    p 1 - 2
11
-                li
12
-                    p 1 - 3
13
-                li
14
-                    p 1 - 4
15
-                li
16
-                    p 1 - 5
7
+                li.shadow(v-for="type in ['episodes', 'exhibitions', 'events', 'artists', 'posts']")
8
+                    .card(v-if="firstPostOfType(type)")
9
+                        router-link(:to="`/${type}`")
10
+                            p.t-up {{type}}
11
+                        router-link(:to="`/${type}/${firstPostOfType(type).slug}`")
12
+                            img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
13
+                            h1.t-up.t-cntr {{ firstPostOfType(type).title }}
14
+                        p episode excerpt, Lorem ipsum dolor sit amet, consectetu
17 15
 
18 16
         section
19
-            ul.max
20
-                li
21
-                    p 2 - 1
17
+            ul.max.w-max
18
+                li.shadow(v-for="post in [randomPostOfType('artists')]")
19
+                    .card(v-if="post")
20
+                        router-link(:to="`/${'artists'}/${post.slug}`")
21
+                            p.t-up {{'artists'}}
22
+                        .f-row(style="justify-content: flex-start;")
23
+                            img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
24
+                            .card--info.f-col.w-max
25
+                                router-link(:to="`/artists/${post.slug}`")
26
+                                    h1.t-up.t-cntr {{ post.title }}
27
+                                    p episode excerpt, Lorem ipsum dolor sit amet, consectetu
22 28
 
23 29
         section
24 30
             ul.flipped
25
-                li
26
-                    p 3 - 1
27
-                li
28
-                    p 3 - 2
29
-                li
30
-                    p 3 - 3
31
-                li
32
-                    p 3 - 4
33
-                li.wide
34
-                    p 3 - 5
35
-        
31
+                li.shadow(v-for="type in ['episodes', 'exhibitions', 'events', 'artists', 'artists']")
32
+                    .random--wrapper(v-for="post in [randomPostOfType(type)]")
33
+                        .card(v-if="post")
34
+                            router-link(:to="`/${type}`")
35
+                                p.t-up {{type}}
36
+                            router-link(:to="`/${type}/${post.slug}`")
37
+                                img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
38
+                                h1.t-up.t-cntr {{ post.title }}
39
+                            p episode excerpt, Lorem ipsum dolor sit amet, consectetu
40
+                                
36 41
         //- if sticky
37 42
         //- li.f-row.wrap.w-max
38 43
         //-     h3(v-if="!allStickyLoaded") loading...
@@ -45,48 +50,6 @@
45 50
         //- li.f-row.wrap.w-max
46 51
         //-     h3(v-if="!allPagesLoaded") loading...
47 52
         //-     .content(v-else-if="allPages['welcome']" v-html="allPages['welcome'].content")
48
-
49
-        //- top section
50
-        //- section(v-if="allEpisodesLoaded").shadow
51
-        //-     router-link(:to="`/episodes`")
52
-        //-         h3.t-up episodes
53
-        //-     router-link(:to="`/episodes/${Object.values(allEpisodes)[0]}`")
54
-        //-         img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
55
-        //-         h2.t-up.t-cntr {{ Object.values(allEpisodes)[0] }}
56
-        //-     p episode excerpt, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nisl ligula, ullamcorper nec dapibus a, ullamcorper a elit. Integer mattis interdum mauris, sit amet feugiat dui consequat et. Curabitur cursus justo quis nunc euismod, nec ornare sem ornare. Mauris eget purus finibus, tempus tellus sed, maximus nisi. Fusce cursus placerat sodales...[…]
57
-
58
-        //- section(v-if="allExhibitionsLoaded").shadow
59
-        //-     router-link(:to="`/exhibitions`")
60
-        //-         h3.t-up exhibitions
61
-        //-     router-link(:to="`/exhibitions/${Object.values(allExhibitions)[0]}`")
62
-        //-         img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
63
-        //-         h2.t-up.t-cntr {{ Object.values(allExhibitions)[0] }}
64
-        //-     p episode excerpt, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nisl ligula, ullamcorper nec dapibus a, ullamcorper a elit. Integer mattis interdum mauris, sit amet feugiat dui consequat et. Curabitur cursus justo quis nunc euismod, nec ornare sem ornare. Mauris eget purus finibus, tempus tellus sed, maximus nisi. Fusce cursus placerat sodales...[…]
65
-
66
-        //- section(v-if="allEventsLoaded").shadow
67
-        //-     router-link(:to="`/events`")
68
-        //-         h3.t-up events
69
-        //-     router-link(:to="`/events/${Object.values(allEvents)[0]}`")
70
-        //-         img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
71
-        //-         h2.t-up.t-cntr {{ Object.values(allEvents)[0] }}
72
-        //-     p episode excerpt, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nisl ligula, ullamcorper nec dapibus a, ullamcorper a elit. Integer mattis interdum mauris, sit amet feugiat dui consequat et. Curabitur cursus justo quis nunc euismod, nec ornare sem ornare. Mauris eget purus finibus, tempus tellus sed, maximus nisi. Fusce cursus placerat sodales...[…]
73
-
74
-        //- section(v-if="allPostsLoaded").shadow
75
-        //-     router-link(:to="`/posts`")
76
-        //-         h3.t-up shorts PLACEHOLDER
77
-        //-     router-link(:to="`/posts/${Object.values(allPosts)[0]}`")
78
-        //-         img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
79
-        //-         h2.t-up.t-cntr {{ Object.values(allPosts)[0] }}
80
-        //-     p episode excerpt, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nisl ligula, ullamcorper nec dapibus a, ullamcorper a elit. Integer mattis interdum mauris, sit amet feugiat dui consequat et. Curabitur cursus justo quis nunc euismod, nec ornare sem ornare. Mauris eget purus finibus, tempus tellus sed, maximus nisi. Fusce cursus placerat sodales...[…]
81
-
82
-        //- //- middle row
83
-        //- section(v-if="allArtistsLoaded").shadow
84
-        //-     router-link(:to="`/artists`")
85
-        //-         h3.t-up artists
86
-        //-     router-link(:to="`/artists/${Object.values(allArtists)[0]}`")
87
-        //-         img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
88
-        //-         h2.t-up.t-cntr {{ Object.values(allArtists)[0] }}
89
-        //-     p episode excerpt, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nisl ligula, ullamcorper nec dapibus a, ullamcorper a elit. Integer mattis interdum mauris, sit amet feugiat dui consequat et. Curabitur cursus justo quis nunc euismod, nec ornare sem ornare. Mauris eget purus finibus, tempus tellus sed, maximus nisi. Fusce cursus placerat sodales...[…]
90 53
 </template>
91 54
 
92 55
 <script>
@@ -118,6 +81,15 @@ export default {
118 81
             }
119 82
             this.$store.commit('SET_HERO', json)
120 83
         },
84
+        firstPostOfType(type) {
85
+            return Object.values(this[`all${convertTitleCase(type)}`])[0]
86
+        },
87
+        randomPostOfType(type) {
88
+            const postsOfType = Object.values(this[`all${convertTitleCase(type)}`])
89
+            const max = postsOfType.length
90
+            const rand = Math.floor(Math.random() * max)
91
+            return postsOfType[rand]
92
+        }
121 93
     }
122 94
 }
123 95
 </script>
@@ -132,33 +104,29 @@ export default {
132 104
         flex-direction: column
133 105
         align-items: stretch
134 106
         section
135
-            border: 1px yellow solid
136 107
             ul
137 108
                 list-style: none
138 109
 @media (min-width: $medium)
139 110
     .page--index > article > section
140 111
         &:nth-of-type(2)
141
-            margin: 1em auto
112
+            margin: 3% 0 2% 0
142 113
         ul
143 114
             display: grid
144 115
             grid-template-columns: 
145 116
                 50% 24% 24%
146 117
             grid-template-rows: 
147
-                47% 47%
118
+                48% 48%
148 119
             gap: 4% 1%
149
-            justify-items: strech
150
-            align-items: stretch
151
-            height: auto
152 120
             li
153
-                min-height: 20em
121
+                min-height: 10em
154 122
                 background-color: purple
155
-                &.wide:nth-of-type(1)
123
+                &:nth-of-type(1)
156 124
                     grid-column-start: 1
157 125
                     grid-row-start: 1
158
-                    grid-row-end: end
126
+                    grid-row-end: 3
159 127
                 &:nth-of-type(2), &:nth-of-type(3)
160
-                    grid-row-start: 1
161 128
                     grid-column-start: 2
129
+                    grid-row-start: 1
162 130
                 &:nth-of-type(3)
163 131
                     grid-column-start: 3
164 132
                 &:nth-of-type(4), &:nth-of-type(5)
@@ -166,21 +134,40 @@ export default {
166 134
                     grid-row-start: 2
167 135
                 &:nth-of-type(5)
168 136
                     grid-column-start: 3
137
+                .card
138
+                    padding: $ms--3 $ms--1
139
+                    overflow: hidden
140
+                    text-overflow: clip
141
+                    &--info
142
+                        justify-content: center
143
+                    img
144
+                        width: 100%
145
+                        height: auto
146
+                    h1, h2, h3, p
147
+                        padding: 0
148
+                        margin: 0
149
+                    h1
150
+                        font-size: $ms-1
169 151
             &.max
170 152
                 grid-template-columns: 
171 153
                     auto
172 154
                 grid-template-rows: 
173 155
                     auto
156
+                > li > .card > img
157
+                    max-width: 50%
174 158
             &.flipped
175 159
                 grid-template-columns: 
176 160
                     24% 24% 50%
177 161
                 li
162
+                    &:nth-of-type(1)
163
+                        grid-column-start: 1
164
+                        grid-row-start: 1
165
+                        grid-row-end: 2
178 166
                     &:nth-of-type(3)
179 167
                         grid-column-start: 1
180 168
                         grid-row-start: 2
181
-                    &.wide:nth-of-type(5)
182
-                        grid-column-start: 3
169
+                    &:nth-of-type(5)
183 170
                         grid-row-start: 1
184
-                        grid-row-end: end
171
+                        grid-row-end: 3
185 172
 
186 173
 </style>

Загрузка…
Отмена
Сохранить