NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. // Homepage grid
  2. <template lang="pug">
  3. .page--index.f-row.between
  4. article.f-grow
  5. //- if sticky
  6. .f-row
  7. h3(v-if="!allStickyLoaded") loading...
  8. section(v-else-if="allStickyLoaded").shadow
  9. h4.t-cap sticky
  10. ul
  11. li(v-for="sticky in allSticky")
  12. p {{ sticky.type }}: {{ sticky.title }}
  13. //- loading
  14. .f-row
  15. h3(v-if="!allPagesLoaded") loading...
  16. .content(v-else-if="allPages['welcome']" v-html="allPages['welcome'].content")
  17. //- top section
  18. .f-row.around
  19. .f-col
  20. section(v-if="allEpisodesLoaded").shadow
  21. router-link(:to="`/episodes`")
  22. h3.t-up episodes
  23. router-link(:to="`/episodes/${Object.values(allEpisodes)[0].slug}`")
  24. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  25. h2.t-up.t-cntr {{ Object.values(allEpisodes)[0].slug }}
  26. 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...[&hellip;]
  27. .f.col
  28. .f-row
  29. section(v-if="allExhibitionsLoaded").shadow
  30. router-link(:to="`/exhibitions`")
  31. h3.t-up exhibitions
  32. router-link(:to="`/exhibitions/${Object.values(allExhibitions)[0].slug}`")
  33. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  34. h2.t-up.t-cntr {{ Object.values(allExhibitions)[0].slug }}
  35. section(v-if="allEventsLoaded").shadow
  36. router-link(:to="`/events`")
  37. h3.t-up events
  38. router-link(:to="`/events/${Object.values(allEvents)[0].slug}`")
  39. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  40. h2.t-up.t-cntr {{ Object.values(allEvents)[0].slug }}
  41. .f-row
  42. section(v-if="allPostsLoaded").shadow
  43. router-link(:to="`/posts`")
  44. h3.t-up shorts PLACEHOLDER
  45. router-link(:to="`/posts/${Object.values(allPosts)[0].slug}`")
  46. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  47. h2.t-up.t-cntr {{ Object.values(allPosts)[0].slug }}
  48. section(v-if="allPostsLoaded").shadow
  49. router-link(:to="`/posts`")
  50. h3.t-up posts
  51. router-link(:to="`/events/${Object.values(allPosts)[0].slug}`")
  52. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  53. h2.t-up.t-cntr {{ Object.values(allPosts)[0].slug }}
  54. //- middle row
  55. .f-row.around
  56. section(v-if="allArtistsLoaded").shadow
  57. router-link(:to="`/artists`")
  58. h3.t-up artists
  59. router-link(:to="`/artists/${Object.values(allArtists)[0].slug}`")
  60. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  61. h2.t-up.t-cntr {{ Object.values(allArtists)[0].slug }}
  62. //- bottom row
  63. .f-row.around
  64. .f.col
  65. .f-row
  66. section(v-if="allPostsLoaded").shadow
  67. router-link(:to="`/objects`")
  68. h3.t-up objects PLACEHOLDER
  69. router-link(:to="`/objects/${Object.values(allPosts)[0].slug}`")
  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(allPosts)[0].slug }}
  72. section(v-if="allPostsLoaded").shadow
  73. router-link(:to="`/techniques`")
  74. h3.t-up techniques PLACEHOLDER
  75. router-link(:to="`/techniques/${Object.values(allPosts)[0].slug}`")
  76. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  77. h2.t-up.t-cntr {{ Object.values(allPosts)[0].slug }}
  78. .f-row
  79. section(v-if="allPostsLoaded").shadow
  80. router-link(:to="`/talks`")
  81. h3.t-up talks PLACEHOLDER
  82. router-link(:to="`/talks/${Object.values(allPosts)[0].slug}`")
  83. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  84. h2.t-up.t-cntr {{ Object.values(allPosts)[0].slug }}
  85. section(v-if="allPostsLoaded").shadow
  86. router-link(:to="`/center`")
  87. h3.t-up center PLACEHOLDER
  88. router-link(:to="`/center/${Object.values(allPosts)[0].slug}`")
  89. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  90. h2.t-up.t-cntr {{ Object.values(allPosts)[0].slug }}
  91. .f-col
  92. section(v-if="allPostsLoaded").shadow
  93. router-link(:to="`/guides`")
  94. h3.t-up guides
  95. router-link(:to="`/guides/${Object.values(allPosts)[0].slug}`")
  96. img.index(src="https://i1.wp.com/www.craftinamerica.org/wp-content/uploads/2020/09/20200210_133120-e1599254267307.jpg")
  97. h2.t-up.t-cntr {{ Object.values(allPosts)[0].slug }}
  98. .f-row
  99. section(v-if="allPagesLoaded").shadow
  100. h3.t-up pages
  101. h2.t-up.t-cntr {{ Object.values(allPages)[0].slug }}
  102. //- footer row
  103. .f-row
  104. footer.f-col
  105. p end of article icon
  106. img(src="../star.svg")
  107. </template>
  108. <script>
  109. import { postTypeGetters, scrollTop } from './mixin-post-types'
  110. import { convertTitleCase, postTypes } from '@/utils/helpers'
  111. export default {
  112. mixins: [postTypeGetters, scrollTop],
  113. created() {
  114. // console.log(wp)
  115. postTypes.forEach(type => {
  116. const capitalizedType = convertTitleCase(type)
  117. this.$store.dispatch(`getAll${capitalizedType}`)
  118. })
  119. this.checkAndSetHero('welcome')
  120. },
  121. methods: {
  122. async checkAndSetHero(type) {
  123. if(!this['allPagesLoaded']) {
  124. await this.$store.dispatch('getAllPages')
  125. }
  126. const page = this.allPages[type]
  127. if(!page) return
  128. let json = { url: page.featured, heroType: 'image' }
  129. if(page.hero && JSON.parse(page.hero) && JSON.parse(page.hero).url) {
  130. json = JSON.parse(page.hero)
  131. json.heroType = 'video'
  132. }
  133. this.$store.commit('SET_HERO', json)
  134. },
  135. }
  136. }
  137. </script>
  138. <style lang="postcss">
  139. @import '../sss/variables.sss'
  140. @import '../sss/theme.sss'
  141. .page--index
  142. article
  143. .f-row
  144. &:nth-of-type(3)
  145. margin: $ms-0 0
  146. section
  147. flex-grow: 1
  148. &:nth-of-type(2)
  149. flex-grow: 3
  150. &:nth-of-type(3), &:nth-of-type(4)
  151. flex-grow: 1
  152. margin: 0 0 0 $ms-0
  153. &:nth-of-type(5), &:nth-of-type(6)
  154. flex-grow: 4
  155. img.index
  156. display: block
  157. width: 20em
  158. margin-left: auto
  159. margin-right: auto
  160. footer
  161. img
  162. width: 30px
  163. height: 30px
  164. </style>