Details.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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="12" md="6">
  40. <v-img :src="getImageUrl(newsItem.attachment)"/>
  41. </v-col>
  42. <v-col cols="12" md="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 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. <CommonAgenda />
  83. </LayoutContainer>
  84. </template>
  85. <script setup lang="ts">
  86. import { useEntityFetch } from "~/composables/data/useEntityFetch";
  87. import News from "~/models/Maestro/News";
  88. import { useDisplay } from "vuetify";
  89. const { mdAndUp, smAndDown } = useDisplay()
  90. const route = useRoute();
  91. const { fetch } = useEntityFetch()
  92. const config = useRuntimeConfig()
  93. const newsId: number = parseInt(route.params.id as string)
  94. if (!newsId || isNaN(newsId)) {
  95. throw new Error('Missing or invalid id')
  96. }
  97. const { data: newsItem, pending } = fetch(News, newsId)
  98. const getImageUrl = (attachment: string): string | null => {
  99. if (!attachment) {
  100. return null
  101. }
  102. return `${config.public.apiBaseUrl}/uploads/news/${attachment}`
  103. }
  104. </script>
  105. <style scoped>
  106. .news {
  107. .v-img {
  108. width: 80%;
  109. margin-left: 3.5rem;
  110. margin-right: auto;
  111. }
  112. h1 {
  113. margin-top: 11rem;
  114. text-decoration: none;
  115. text-transform: uppercase;
  116. font-size: 36px;
  117. font-weight: 600;
  118. @media (max-width: 600px) {
  119. margin-top: 3rem;
  120. }
  121. }
  122. .description {
  123. color: var(--primary-color);
  124. text-align: justify;
  125. font-size: 30px;
  126. font-weight: 500;
  127. line-height: 34px;
  128. margin-left: 3.5rem;
  129. margin-right: 3.5rem;
  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>