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.

sidebar.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template lang="pug">
  2. aside.sidebar
  3. section
  4. //- if not single layout with sorting
  5. .shadow(v-if="shouldShowListSort.includes(type) && layout !== 'single'")
  6. h3.t-up sort {{ type }}s
  7. ul.t-up
  8. li
  9. //- post?type=articles //
  10. router-link(v-if="type === 'post' " :to="`/${type}?type=articles`")
  11. p in the news
  12. li
  13. //- post?type=releases //
  14. router-link(v-if="type === 'post' " :to="`/${type}?type=releases`")
  15. p press releases
  16. li
  17. //- event?type=concerts //
  18. router-link(v-if="type === 'event' " :to="`/${type}?type=concerts`")
  19. p concerts
  20. li
  21. //- event?type=openings //
  22. router-link(v-if="type === 'event' " :to="`/${type}?type=openings`")
  23. p openings
  24. li
  25. //- event?type=talks //
  26. router-link(v-if="type === 'event' " :to="`/${type}?type=talks`")
  27. p talks
  28. li
  29. //- event?type=workshops //
  30. router-link(v-if="type === 'event' " :to="`/${type}?type=workshops`")
  31. p workshops
  32. //- by type //
  33. li(v-for="option in sortOptions")
  34. router-link(:to="`/${type}/sorted/${sortTypes[option]}`")
  35. p {{ option }}
  36. li
  37. router-link(v-if="shouldShowDateSort.includes(type) " :to="`/${type}/sorted/by-current-and-upcoming`")
  38. p current and upcoming
  39. li
  40. //- router-link(v-if="type === ('post') " :to="`/${type}/`")
  41. router-link(v-if="type === ('post') " :to="`/blog`")
  42. p by all
  43. //- if artist has sorted by-alpha show alpha sets
  44. .shadow(v-if="['artist'].includes(type) && layout !== 'single'")
  45. h3.t-up {{ type }} by alpha
  46. ul.t-up
  47. li.f-row.start.wrap
  48. template(v-for="charaSet in charaSets")
  49. router-link(:to="`/${type}/sorted/by-alpha#${charaSet[0]}`")
  50. p.alpha {{ charaSet }}
  51. //- if {{type}} has sorted by-material show material sets
  52. .shadow(v-if="shouldShowMaterialSort.includes(type) && layout !== 'single'")
  53. h3.t-up {{ type }}s by material
  54. ul.t-up
  55. li
  56. template(v-for="material in materials")
  57. router-link(:to="`/${type}/sorted/by-material#${material}`")
  58. p {{ material }}
  59. //- if {{type}} has sorted by-episode show episode sets
  60. .shadow(v-if="shouldShowEpisodeSort.includes(type) && layout !== 'single'")
  61. h3.t-up {{ type }}s by episode
  62. ul.t-up
  63. li.f-row.start.wrap
  64. template(v-for="episodeSet in episodeSets")
  65. router-link(:to="`/${type}/sorted/by-episode#${episodeSet}`")
  66. p {{ episodeSet }} &nbsp;&nbsp;
  67. //- if {{type}} has sorted by-type show subtype sets
  68. .shadow(v-if="shouldShowTypeSort.includes(type) && layout !== 'single'")
  69. h3.t-up {{ type }}s type
  70. ul.t-up
  71. li
  72. template(v-for="subtypeSet in subtypeSets")
  73. router-link(:to="`/${type}/sorted/by-type#${subtypeSet}`")
  74. p {{ subtypeSet }}
  75. //- p2p types and related posts
  76. .shadow(v-if="layout === 'single' && Object.keys(related).length" v-for="p2pPostType in Object.keys(related)")
  77. related-sidebar(:posts-by-type="related" :post-type="p2pPostType")
  78. //- Optional passthrough
  79. slot
  80. //- single layout Exhibitions sidebar
  81. .shadow(v-if="type === 'exhibition'")
  82. events-sidebar
  83. //- single layout Events sidebar
  84. .shadow(v-if="type === 'event'")
  85. exhibitions-sidebar
  86. //- single layout type.post sidebar
  87. .shadow(v-if="type === 'post'")
  88. exhibitions-sidebar
  89. .shadow(v-if="type === 'post'")
  90. events-sidebar
  91. //- single layout page sidebar
  92. .shadow(v-if="type === 'page'")
  93. events-sidebar
  94. .shadow(v-if="type === 'page'")
  95. exhibitions-sidebar
  96. </template>
  97. <script>
  98. // related sidebar list
  99. import relatedSidebar from './related'
  100. import exhibitionsSidebar from './exhibitions'
  101. import eventsSidebar from './events'
  102. import { sortTypes, materials } from '@/utils/helpers'
  103. export default {
  104. props: {
  105. type: {
  106. type: String,
  107. },
  108. layout: {
  109. type: String,
  110. },
  111. related: {
  112. type: Object,
  113. },
  114. },
  115. components: {
  116. exhibitionsSidebar, eventsSidebar, relatedSidebar,
  117. },
  118. data() {
  119. return {
  120. sortTypes: {
  121. alphabetized: `${sortTypes.alpha}`, //:0
  122. 'by material': `${sortTypes.material}`, //:1
  123. 'by artist': `${sortTypes.artist}`, //:2
  124. 'by episode': `${sortTypes.episode}`, //:3
  125. 'by type': `${sortTypes.subtype}`, //:4
  126. 'by past': `${sortTypes.past}`, //:5
  127. // subtype: 'by-type',
  128. },
  129. charaSets: [
  130. '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
  131. 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
  132. ],
  133. episodeSets: [
  134. 'inspiration', 'home', 'jewelry', 'harmony', 'storytellers',
  135. 'democracy', 'identity', 'quilts', 'visionaries', 'california',
  136. 'neighbors', 'borders', 'nature', 'teachers', 'music',
  137. 'celebration', 'service', 'industry', 'holiday', 'forge',
  138. 'crossroads', 'threads', 'family', 'messages', 'process',
  139. 'origins', 'community', 'landscape', 'memory'
  140. ],
  141. subtypeSets: [
  142. 'schools', 'museums', 'collectors', 'organizations', 'galleries'
  143. ],
  144. materials: materials,
  145. shouldShowListSort: [
  146. 'artist', 'exhibition', 'event', 'short',
  147. 'technique', 'guide', 'object', 'publication', 'post'
  148. ],
  149. shouldShowMaterialSort: [
  150. 'artist', 'short', 'technique',
  151. 'guide', 'object', 'publication',
  152. ],
  153. shouldShowEpisodeSort: [
  154. 'artist', 'short', 'technique', 'guide'
  155. ],
  156. shouldShowAlphaSort: [
  157. 'artist'
  158. ],
  159. shouldShowDateSort: [
  160. 'exhibition', 'event'
  161. ],
  162. shouldShowTypeSort: [
  163. 'artist'
  164. ]
  165. }
  166. },
  167. computed: {
  168. sortOptions() {
  169. let opts = []
  170. switch (this.type) {
  171. case 'artist':
  172. opts = [
  173. Object.keys(this.sortTypes)[0],
  174. Object.keys(this.sortTypes)[1],
  175. Object.keys(this.sortTypes)[3],
  176. Object.keys(this.sortTypes)[4],
  177. // `by ${this.type} type`,
  178. ]
  179. break
  180. case 'exhibition':
  181. opts = [
  182. Object.keys(this.sortTypes)[5],
  183. ]
  184. break
  185. case 'event':
  186. opts = [
  187. Object.keys(this.sortTypes)[5],
  188. ]
  189. break
  190. case 'post':
  191. opts = [
  192. Object.keys(this.sortTypes)[4],
  193. ]
  194. break
  195. case 'short':
  196. opts = [
  197. Object.keys(this.sortTypes)[3],
  198. Object.keys(this.sortTypes)[1],
  199. ]
  200. break
  201. case 'guide':
  202. opts = [
  203. Object.keys(this.sortTypes)[3],
  204. Object.keys(this.sortTypes)[1],
  205. ]
  206. break
  207. case 'object':
  208. opts = [
  209. Object.keys(this.sortTypes)[1],
  210. ]
  211. break
  212. case 'publication':
  213. opts = [
  214. Object.keys(this.sortTypes)[1],
  215. ]
  216. break
  217. case 'technique':
  218. opts = [
  219. Object.keys(this.sortTypes)[3],
  220. Object.keys(this.sortTypes)[1],
  221. ]
  222. break
  223. }
  224. return opts
  225. },
  226. },
  227. }
  228. </script>
  229. <style lang="postcss">
  230. // prettier-ignore
  231. @import '../../sss/variables.sss'
  232. @import '../../sss/theme.sss'
  233. aside.sidebar
  234. /* need to solve for mobile as the sticky creates scroll issues */
  235. /* position: sticky */
  236. top: 40px
  237. width: 100%
  238. font-size: x-small
  239. p, h3
  240. margin: 0
  241. padding: 0 0 $ms--4 0
  242. &.date
  243. font-size: $ms--1
  244. > section
  245. > *
  246. padding: $ms-0
  247. margin: 0 0 $ms-0 0
  248. display: table-cell
  249. > .post
  250. /* background-color: blue */
  251. ul
  252. list-style: none
  253. display: flex
  254. flex-direction: column
  255. flex-wrap: wrap
  256. li
  257. /* padding: 0 0 $ms-0 0 */
  258. img
  259. display: none
  260. padding: $ms-0 0 $ms--4 0
  261. p.alpha
  262. padding: 0 $ms--4
  263. .shadow
  264. background-color: white
  265. /* width larger than $medium */
  266. @media (min-width: $medium)
  267. aside.sidebar
  268. position: sticky
  269. min-width: 25%
  270. width: 25%
  271. font-size: revert
  272. > section
  273. > *
  274. display: inherit
  275. ul
  276. flex-direction: column
  277. li
  278. img
  279. display: block
  280. width: 100%
  281. </style>