Details.vue 3.8 KB

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