Details.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <LayoutContainer>
  3. <div class="news-section">
  4. <v-row class="mb-6 center-90">
  5. <v-col class="d-flex align-items-center">
  6. <v-btn
  7. to="/actualites"
  8. prepend-icon="fas fa-arrow-left"
  9. variant="outlined"
  10. class="back-button"
  11. >
  12. Retour aux actualités
  13. </v-btn>
  14. </v-col>
  15. </v-row>
  16. <div>
  17. <div v-if="pending">
  18. <v-row class="justify-center progress">
  19. <v-progress-circular
  20. indeterminate
  21. color="grey"
  22. />
  23. </v-row>
  24. </div>
  25. <div v-else-if="newsItem !== null" class="news">
  26. <CommonMeta
  27. :title="newsItem.title"
  28. :description="newsItem.leadText"
  29. />
  30. <v-row class="center-90 mb-12">
  31. <v-col cols="12" md="6">
  32. <v-img
  33. :src="getImageUrl(newsItem.attachment)"
  34. cover
  35. />
  36. </v-col>
  37. <v-col cols="12" md="6" class="d-flex flex-column justify-center">
  38. <h3>
  39. {{ newsItem.title }}
  40. </h3>
  41. <strong>
  42. {{ newsItem.leadText }}
  43. </strong>
  44. </v-col>
  45. </v-row>
  46. <v-row class="center-90">
  47. <p
  48. v-html="newsItem.bodyText"
  49. class="description"
  50. />
  51. </v-row>
  52. <v-row class="d-flex justify-center align-center">
  53. <v-btn class="btn-plus mb-12" text>
  54. En savoir plus
  55. </v-btn>
  56. </v-row>
  57. <v-row class="d-flex justify-space-between center-90">
  58. <div>
  59. <p v-if="newsItem.tags.length > 0">
  60. MOTS CLÉS
  61. </p>
  62. </div>
  63. <div v-if="mdAndUp">
  64. <p>PARTAGER</p>
  65. </div>
  66. </v-row>
  67. <v-row class="d-flex justify-space-between mb-8 center-90">
  68. <p class="key-word mt-3">
  69. <span v-for="tag in newsItem.tags" class="mr-2">
  70. {{ tag.name }}
  71. </span>
  72. </p>
  73. <CommonShare v-if="mdAndUp" />
  74. </v-row>
  75. <div v-if="smAndDown" class="center-90">
  76. <p>PARTAGER</p>
  77. <CommonShare />
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </LayoutContainer>
  83. </template>
  84. <script setup lang="ts">
  85. import { useEntityFetch } from "~/composables/data/useEntityFetch";
  86. import News from "~/models/Maestro/News";
  87. import { useDisplay } from "vuetify";
  88. const { mdAndUp, smAndDown } = useDisplay()
  89. const route = useRoute();
  90. const { fetch } = useEntityFetch()
  91. const config = useRuntimeConfig()
  92. const newsId: number = parseInt(route.params.id as string)
  93. if (!newsId || isNaN(newsId)) {
  94. throw new Error('Missing or invalid id')
  95. }
  96. const { data: newsItem, pending } = fetch(News, newsId)
  97. const getImageUrl = (attachment: string): string | null => {
  98. if (!attachment) {
  99. return null
  100. }
  101. return `${config.public.apiBaseUrl}/uploads/news/${attachment}`
  102. }
  103. </script>
  104. <style scoped>
  105. .news {
  106. .v-img {
  107. max-height: 600px;
  108. margin-left: auto;
  109. margin-right: auto;
  110. }
  111. h3 {
  112. text-decoration: none;
  113. text-transform: uppercase;
  114. font-size: 36px;
  115. font-weight: 600;
  116. color: var(--primary-color);
  117. }
  118. strong {
  119. font-size: 21px;
  120. margin-top: 16px;
  121. }
  122. .description {
  123. color: var(--primary-color);
  124. max-width: 80%;
  125. font-size: 21px;
  126. font-weight: 500;
  127. line-height: 34px;
  128. margin-left: auto;
  129. margin-right: auto;
  130. margin-bottom: 3rem;
  131. }
  132. .btn-plus {
  133. background: var(--secondary-color);
  134. color: var(--on-secondary-color);
  135. display: flex;
  136. left: 0;
  137. padding: 25px 28px;
  138. align-items: center;
  139. gap: 9px;
  140. font-size: 0.9rem;
  141. border-radius: 5px;
  142. font-weight: 700;
  143. line-height: 15px;
  144. letter-spacing: 1.3px;
  145. text-transform: uppercase;
  146. margin-bottom: -1rem;
  147. }
  148. }
  149. .back-button {
  150. text-decoration: none;
  151. color: var(--on-neutral-color);
  152. font-size: 0.9rem;
  153. font-weight: 700;
  154. line-height: 15px;
  155. letter-spacing: 1.8px;
  156. text-transform: uppercase;
  157. }
  158. .key-word {
  159. color: var(--on-neutral-color);
  160. font-size: 20px;
  161. font-weight: 500;
  162. line-height: 24px;
  163. }
  164. </style>