Details.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. <CommonMeta
  35. :title="newsItem.title"
  36. :description="newsItem.leadText"
  37. />
  38. <v-row class="center-90">
  39. <v-col cols="6">
  40. <v-img :src="getImageUrl(newsItem.attachment)"/>
  41. </v-col>
  42. <v-col cols="6">
  43. <h1>
  44. {{ newsItem.title }}
  45. </h1>
  46. </v-col>
  47. </v-row>
  48. <v-row class="center-90">
  49. <p
  50. v-html="newsItem.bodyText"
  51. class="description"
  52. />
  53. </v-row>
  54. <v-row class="d-flex justify-center align-center">
  55. <v-btn prepend-icon="fas fa-info" class="btn-plus mb-12" text>
  56. En savoir plus
  57. </v-btn>
  58. </v-row>
  59. <v-row class="d-flex justify-space-between center-90">
  60. <p>
  61. MOTS CLÉS
  62. </p>
  63. <div>
  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 />
  74. </v-row>
  75. </div>
  76. </div>
  77. </div>
  78. <CommonAgenda />
  79. </LayoutContainer>
  80. </template>
  81. <script setup lang="ts">
  82. import { useEntityFetch } from "~/composables/data/useEntityFetch";
  83. import News from "~/models/Maestro/News";
  84. const route = useRoute();
  85. const { fetch } = useEntityFetch()
  86. const config = useRuntimeConfig()
  87. const newsId: number = parseInt(route.params.id as string)
  88. if (!newsId || isNaN(newsId)) {
  89. throw new Error('Missing or invalid id')
  90. }
  91. const { data: newsItem, pending } = fetch(News, newsId)
  92. const getImageUrl = (attachment: string): string | null => {
  93. if (!attachment) {
  94. return null
  95. }
  96. return `${config.public.apiBaseUrl}/uploads/news/${attachment}`
  97. }
  98. </script>
  99. <style scoped>
  100. .news {
  101. .v-img {
  102. width: 80%;
  103. margin-left: 3.5rem;
  104. margin-right: auto;
  105. }
  106. h1 {
  107. margin-top: 11rem;
  108. text-decoration: none;
  109. text-transform: uppercase;
  110. font-size: 36px;
  111. font-weight: 600;
  112. }
  113. .description {
  114. color: var(--primary-color);
  115. text-align: justify;
  116. font-size: 30px;
  117. font-weight: 500;
  118. line-height: 34px;
  119. margin-left: 3.5rem;
  120. margin-right: 3.5rem;
  121. margin-bottom: 3rem;
  122. }
  123. .btn-plus {
  124. background: var(--secondary-color);
  125. color: var(--on-secondary-color);
  126. display: flex;
  127. left: 0;
  128. padding: 25px 28px;
  129. align-items: center;
  130. gap: 9px;
  131. font-size: 0.9rem;
  132. border-radius: 5px;
  133. font-weight: 700;
  134. line-height: 15px;
  135. letter-spacing: 1.3px;
  136. text-transform: uppercase;
  137. margin-bottom: -1rem;
  138. }
  139. }
  140. .back-button {
  141. text-decoration: none;
  142. color: var(--on-neutral-color);
  143. font-size: 0.9rem;
  144. font-weight: 700;
  145. line-height: 15px;
  146. letter-spacing: 1.8px;
  147. text-transform: uppercase;
  148. }
  149. .key-word {
  150. color: var(--on-neutral-color);
  151. font-size: 20px;
  152. font-weight: 500;
  153. line-height: 24px;
  154. }
  155. </style>