NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

navigation.vue 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. // Replace with calls to menu system
  2. <template lang="pug">
  3. nav.main.w-max
  4. .menu
  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="['events','exhibitions'].includes(item)" :to="`/${item}/by-current-and-upcoming`")
  14. h5.t-up {{ item }}
  15. router-link(v-else :to="`/${item}`")
  16. h5.t-up {{ item }}
  17. .mobile-menu
  18. .f-row.start
  19. router-link(to="/")
  20. img(src="../../star.svg")
  21. router-link(to="/")
  22. h1.t-serif.t-up craft in america
  23. label(for="toggle-mobile-menu" aria-label="Menu").drop-down &#9776;
  24. input(id="toggle-mobile-menu" type="checkbox").hide
  25. ul.drop-down.w-max
  26. li(v-for="item in menuItems")
  27. router-link(@click="uncheck" :to="`/${item}`")
  28. h5.t-up {{ item }}
  29. </template>
  30. <script>
  31. import { postTypes } from '@/utils/helpers'
  32. import { computed } from '@vue/runtime-core'
  33. export default {
  34. setup() {
  35. /**
  36. * Navigation items
  37. * Auto-includes declared postTypes
  38. * and extra items
  39. * TIP: Add things to the ignored array
  40. * to remove from the nav
  41. */
  42. const menuItems = computed(() => {
  43. const extras = [
  44. // 'center',
  45. // 'education',
  46. // 'resources',
  47. // 'support',
  48. // 'about',
  49. // '🔍'
  50. ]
  51. const ignored = [
  52. 'pages',
  53. 'sticky',
  54. // 'posts',
  55. ]
  56. const filtered = postTypes.filter(val => !ignored.includes(val))
  57. return [...filtered, ...extras]
  58. })
  59. const uncheck = () => {
  60. document.getElementById('toggle-mobile-menu').checked = false
  61. }
  62. return {
  63. menuItems,
  64. uncheck
  65. }
  66. },
  67. }
  68. </script>
  69. <style lang="postcss">
  70. // prettier-ignore
  71. @import '../../sss/variables.sss'
  72. @import '../../sss/theme.sss'
  73. nav.main
  74. position: sticky
  75. top: 0
  76. /* background-color: lightblue */
  77. background-color: $cia_grey
  78. word-wrap: break-word
  79. z-index: 10002
  80. .menu, .mobile-menu
  81. /* padding: $ms-0 0 */
  82. a
  83. color: $cia_black
  84. &:hover
  85. color: $cia_darker
  86. h1
  87. font-size: $ms-2
  88. font-weight: 400
  89. color: $cia_red
  90. text-decoration: none
  91. img
  92. width: $ms-3
  93. height: $ms-3
  94. padding: 0
  95. .menu
  96. display: none
  97. h1
  98. margin: 0
  99. h5
  100. font-size: $ms--1
  101. font-weight: 400
  102. margin: 0
  103. img
  104. margin: 0 0 calc(-1 * $ms--5) 0
  105. > ul
  106. padding: 0 0 0 $ms-0
  107. > li:nth-child(1)
  108. a
  109. text-decoration: none
  110. > li:nth-child(n+2)
  111. a > h5
  112. padding: $ms-1
  113. .mobile-menu
  114. a
  115. text-decoration: none
  116. /* cia logotype adjust for smaller screens */
  117. img
  118. margin: $ms--7 $ms--6 0 $ms-0
  119. h1
  120. padding: $ms--4 0
  121. margin: 0 0 0 calc(-1 * $ms--7)
  122. /* hamburger menu drawer */
  123. label
  124. position: absolute
  125. right: 0
  126. top: 0
  127. padding: $ms-0
  128. &:hover
  129. color: $primary-dark
  130. cursor: pointer
  131. /* make this menu style for $small min-width 480px screen */
  132. input
  133. &.hide
  134. display: none
  135. cursor: pointer
  136. &:checked + ul
  137. display: block
  138. position: absolute
  139. width: 100%
  140. ul
  141. /* background-color: $primary-dark */
  142. background-color: $cia_grey
  143. display: none
  144. margin: 1px 0 0 0
  145. box-shadow: lightgrey $ms--7 $ms--7 $ms--7
  146. li
  147. /* color: $primary-light */
  148. &:hover
  149. color: $primary-dark
  150. background-color: $primary-light
  151. transition: $transition
  152. h5
  153. /* font-size: $ms-0 */
  154. /* color: $cia_black */
  155. padding: $ms--1
  156. /* padding: 0 */
  157. margin: 0
  158. @media (min-width: $large)
  159. .menu
  160. display: flex
  161. justify-content: center
  162. .mobile-menu
  163. display: none
  164. @media (min-width: $extra-large)
  165. .menu > ul
  166. max-width: $max-width
  167. </style>