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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. // Replace with calls to menu system
  2. <template lang="pug">
  3. nav.main.w-max
  4. .menu.f-col
  5. ul.f-row.w-max
  6. li.f-row.start
  7. router-link(to="/")
  8. img(src="../../star.svg")
  9. router-link(to="/")
  10. h1.t-serif.t-up craft in america
  11. //- li.f-grow
  12. //- li(v-for="item in menuItems")
  13. //- router-link(v-if="['event','exhibition'].includes(item)" :to="`/${item}/sorted/${sortTypes.currentAndUpcoming}`")
  14. //- h5.t-up {{ item }}
  15. //- router-link(v-else-if="['artist'].includes(item)" :to="`/${item}/sorted/${sortTypes.alpha}`")
  16. //- h5.t-up {{ item }}
  17. //- router-link(v-else :to="`/${item}`")
  18. //- h5.t-up {{ item }}
  19. //- hardcoded menu
  20. li.f-grow
  21. li.t-up PBS Series
  22. ul.submenu
  23. li
  24. router-link(to="/episode") Episodes
  25. li
  26. router-link(to="/short") Shorts
  27. li
  28. router-link(to="/technique") Techniques
  29. li.f-grow
  30. li.t-up Artists
  31. ul.submenu
  32. li
  33. router-link(to="/artist/sorted/by-alpha") A - Z
  34. li
  35. router-link(to="/artist/sorted/by-material") By Material
  36. li.f-grow
  37. li.t-up Exhibitions
  38. ul.submenu
  39. li
  40. router-link(to="/exhibition/sorted/by-current-and-upcoming") Current/Upcoming
  41. li
  42. router-link(to="/exhibition/sorted/by-date") Past
  43. li
  44. router-link(to="/object") Explore Craft Objects
  45. li.f-grow
  46. li.t-up Center
  47. ul.submenu
  48. li
  49. router-link(to="/page/center") Info
  50. li
  51. router-link(to="/event/sorted/by-current-and-upcoming") Events Current/Upcoming
  52. li
  53. router-link(to="/event/sorted/by-type") Talks & Interviews
  54. li
  55. router-link(to="/page/library") Library
  56. li.f-grow
  57. li.t-up Education
  58. ul.submenu
  59. li
  60. router-link(to="/guide") Education Guides
  61. li
  62. router-link(to="/page/video-resources-for-educators") Video Resources
  63. li
  64. router-link(to="/page/craft-in-schools") Craft in Schools
  65. li
  66. router-link(to="/page/craft-resources-map") Craft Resource Map
  67. li
  68. router-link(to="/publication") Publications
  69. li
  70. router-link(to="/page/library") Library
  71. li.f-grow
  72. li.t-up Resources
  73. ul.submenu
  74. li
  75. router-link(to="/page/artists-resources") Opportunities
  76. li
  77. router-link(to="/artist/sorted/by-type") Organizations and Institutions
  78. li
  79. router-link(to="/page/craft-resources-map") Craft Resources Map
  80. li
  81. router-link(to="/page/community-craft-calendar") Community Craft Calendar
  82. li.f-grow
  83. li.t-up Support
  84. ul.submenu
  85. li
  86. router-link(to="/page/donate") Donate
  87. li
  88. router-link(to="/page/shop") Shop
  89. li.f-grow
  90. li.t-up About
  91. ul.submenu
  92. li
  93. router-link(to="/page/about") Craft in America
  94. li
  95. router-link(to="/page/mission") Mission
  96. li
  97. router-link(to="/page/staff") Staff
  98. li
  99. router-link(to="/page/board") Board of Directors
  100. li
  101. router-link(to="/page/contact") Contact
  102. li.f-grow
  103. li.t-up
  104. a(@click="toggleSearch") search
  105. ul(v-if="isSearchOpen").search.w-max
  106. li.f-row.w-max
  107. input(v-model="searchTerms" @keyup.enter="sendSearch" tabindex="10")
  108. button.b-none.bg-none(@click="sendSearch" tabindex="11") 🔍
  109. .mobile-menu
  110. .f-row.start
  111. router-link(to="/")
  112. img(src="../../star.svg")
  113. router-link(to="/")
  114. h1.t-serif.t-up craft in america
  115. label(for="toggle-mobile-menu" aria-label="Menu").drop-down &#9776;
  116. input(id="toggle-mobile-menu" type="checkbox").hide
  117. ul.drop-down.w-max
  118. li(v-for="item in menuItems")
  119. router-link(@click="uncheck" :to="`/${item}`")
  120. h5.t-up {{ item }}
  121. </template>
  122. <script>
  123. import { computed, ref, nextTick } from '@vue/runtime-core'
  124. import { useRouter } from 'vue-router'
  125. import { postTypes, sortTypes } from '@/utils/helpers'
  126. export default {
  127. setup() {
  128. const router = useRouter()
  129. const searchTerms = ref('')
  130. const isSearchOpen = ref(false)
  131. const toggleSearch = () => {
  132. isSearchOpen.value = !isSearchOpen.value
  133. if(isSearchOpen.value) {
  134. nextTick(() => {
  135. const searchBox = document.querySelector('ul.search > li > input')
  136. searchBox.focus()
  137. })
  138. }
  139. }
  140. const sendSearch = () => {
  141. router.push({ path: '/search', query: { s: searchTerms.value } })
  142. searchTerms.value = ''
  143. toggleSearch()
  144. }
  145. /**
  146. * Navigation items
  147. * Auto-includes declared postTypes
  148. * and extra items
  149. * TIP: Add things to the ignore array
  150. * to remove from the nav
  151. */
  152. const menuItems = computed(() => {
  153. const extras = [
  154. 'blog',
  155. // 'education',
  156. // 'resources',
  157. // 'support',
  158. // 'about',
  159. '🔍'
  160. ]
  161. const ignore = [
  162. 'page',
  163. 'post',
  164. 'sticky',
  165. ]
  166. const filtered = postTypes.filter(val => !ignore.includes(val))
  167. return [...filtered, ...extras]
  168. })
  169. const uncheck = () => {
  170. document.getElementById('toggle-mobile-menu').checked = false
  171. }
  172. return {
  173. sortTypes,
  174. menuItems,
  175. uncheck,
  176. searchTerms,
  177. sendSearch,
  178. toggleSearch,
  179. isSearchOpen
  180. }
  181. },
  182. }
  183. </script>
  184. <style lang="postcss">
  185. // prettier-ignore
  186. @import '../../sss/variables.sss'
  187. @import '../../sss/theme.sss'
  188. nav.main
  189. position: sticky
  190. top: 0
  191. background-color: $cia_grey
  192. word-wrap: break-word
  193. z-index: 10002
  194. .menu, .mobile-menu, .submenu
  195. a
  196. text-decoration: none
  197. color: $cia_black
  198. &:hover
  199. color: $cia_darker
  200. h1
  201. font-size: $ms-3
  202. font-weight: 400
  203. color: $cia_red
  204. text-decoration: none
  205. img
  206. width: $ms-3
  207. height: $ms-3
  208. padding: 0
  209. .menu > ul
  210. position: relative
  211. padding: 0 0 0 $ms-0
  212. &.search
  213. background-color: #fefefe
  214. box-shadow: 1px 1px 1px $lighter
  215. position: absolute
  216. top: 36px
  217. padding: 0
  218. input
  219. width: 50%
  220. font-size: $ms-2
  221. .menu
  222. h1
  223. margin: $ms--7 0 0
  224. h5
  225. font-size: $ms--1
  226. font-weight: 400
  227. margin: 0
  228. img
  229. margin: 0 $ms--2 calc(-1 * $ms--6) 0
  230. > ul > li
  231. &:nth-child(1)
  232. a
  233. text-decoration: none
  234. &:nth-child(n+2)
  235. a > h5
  236. padding: $ms-1
  237. //- menu hover
  238. &:hover
  239. color: $cia_red1
  240. display: block
  241. cursor: pointer
  242. transition: $transition
  243. ul.submenu
  244. display: block
  245. position: absolute
  246. background-color: $lighter
  247. padding: 0 0.5em 0.5em
  248. opacity: 0
  249. //- submenu hover
  250. &:hover
  251. display: block
  252. background-color: $lighter
  253. opacity: 1
  254. transition: $transition
  255. > li
  256. line-height: 1.5
  257. width: max-content
  258. background-color: $lighter
  259. //- list hover
  260. &:hover
  261. display: block
  262. background-color: $lighter
  263. .mobile-menu
  264. a
  265. /* cia logotype for smaller screens */
  266. img
  267. margin: $ms--7 $ms--6 0 $ms-0
  268. h1
  269. padding: $ms--4 0 0
  270. margin: 0 0 $ms--7 $ms--7
  271. /* hamburger menu drawer */
  272. label
  273. position: absolute
  274. right: 0
  275. top: 0
  276. padding: $ms--4 $ms--2
  277. font-size: $ms-2
  278. &:hover
  279. color: $cia_darker
  280. cursor: pointer
  281. /* make this menu style for $small min-width 480px screen */
  282. input
  283. &.hide
  284. display: none
  285. cursor: pointer
  286. &:checked + ul
  287. display: block
  288. position: absolute
  289. width: 100%
  290. ul
  291. background-color: $cia_red
  292. display: none
  293. margin: 0.5px 0 0 0
  294. box-shadow: lightgrey $ms--7 $ms--7 $ms--7
  295. li
  296. /* color: $primary-light */
  297. &:hover
  298. /* color: $cia_red2 */
  299. background-color: $cia_red1
  300. transition: $transition
  301. h5
  302. /* font-size: $ms-0 */
  303. color: $cia_white
  304. padding: $ms--1
  305. /* padding: 0 */
  306. margin: 0
  307. @media (max-width: $large)
  308. .menu
  309. display: none
  310. @media (min-width: $large)
  311. .menu
  312. display: flex
  313. justify-content: center
  314. .mobile-menu
  315. display: none
  316. @media (min-width: $extra-large)
  317. .menu > ul
  318. max-width: $max-width
  319. </style>