NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

card.vue 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template lang="pug">
  2. .card(v-if="content")
  3. header
  4. router-link(v-if="!hideType && ['event','exhibition'].includes(type)" :to="`/${type}/by-current-and-upcoming`")
  5. p.t-up {{type}}
  6. router-link(v-else-if="!hideType" :to="`/${type}`")
  7. p.t-up {{type}}
  8. article.card--info(:class="{ 'wide': wide }")
  9. router-link(:to="`/${type}/${content.slug}`")
  10. //- set image to thumbnail setting
  11. featured-image(:post="content", thumbsize="'standard'")
  12. .f-col.w-max
  13. router-link(:to="`/${type}/${content.slug}`")
  14. h1.t-up.t-cntr.t-b {{ content.title }}
  15. p(v-if="content.end && type == 'event'" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event').split(',')[1] }}
  16. p(v-else-if="content.end" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event') }}
  17. p.excerpt {{ content.excerpt }}
  18. router-link(:to="`/${type}/${content.slug}`")
  19. p.read-more read more
  20. </template>
  21. <script>
  22. import featuredImage from '@/components/featured-image'
  23. export default {
  24. components: { featuredImage },
  25. props: ['type', 'content', 'wide', 'hide-type'],
  26. methods: {
  27. dateFrom(unix, includeTime) {
  28. const d = new Date(parseInt(unix) * 1000)
  29. return includeTime ? d.toLocaleString('en-US', { timeZone: 'UTC' }) : d.toLocaleDateString('en-US')
  30. }
  31. }
  32. }
  33. </script>
  34. <style lang="postcss">
  35. // prettier-ignore
  36. @import '../sss/variables.sss'
  37. @import '../sss/theme.sss'
  38. .card
  39. background-color: white
  40. padding: $ms--1
  41. overflow: hidden
  42. text-overflow: clip
  43. &--info
  44. justify-content: center
  45. > a
  46. line-height: 0
  47. /* Force crop images */
  48. .featured-or-hero-image img
  49. object-fit: cover
  50. object-position: 0% 30%
  51. max-height: 160px
  52. overflow-y: clip
  53. header a
  54. font-size: $ms--2
  55. text-decoration: none
  56. margin: 0
  57. p
  58. margin: 0
  59. img
  60. width: 100%
  61. height: auto
  62. h1, h2, h3
  63. padding: $ms--3
  64. margin: 0
  65. h1
  66. font-size: $ms-0
  67. padding: 0
  68. line-height: initial
  69. p
  70. &.datetime
  71. font-size: $ms--1
  72. margin: 0
  73. &.excerpt
  74. overflow: hidden
  75. margin: 0
  76. &.read-more
  77. font-size: $ms--1
  78. /* for widths larger than 768px */
  79. @media (min-width: $medium)
  80. .card
  81. &--info
  82. justify-content: center
  83. .wide
  84. display: flex
  85. padding: 0
  86. grid-gap: $ms-0
  87. </style>