Banner.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <LayoutContainer v-intersect="onIntersect">
  3. <v-row>
  4. <v-col cols="12">
  5. <div class="banner-container">
  6. <img
  7. :src="imageSrc"
  8. :alt="imageAlt"
  9. :class="['cover-image', reverseImage ? 'reverse' : '']"
  10. />
  11. <div v-if="logoSrc" class="details-square">
  12. <v-row>
  13. <div class="content-row">
  14. <img
  15. src="/images/components/banner/Icone_instruments_de_musique_trompette_et_tambour_avec_des_notes_de_musique.svg"
  16. alt="Icône instruments de musique trompette et tambour avec des notes de musique"
  17. class="custom-icon"
  18. />
  19. <p class="description">
  20. {{ squareText }}
  21. </p>
  22. </div>
  23. </v-row>
  24. </div>
  25. <div
  26. v-if="logoSrc"
  27. :class="'logo-square' + (logoAltTheme ? ' alt-theme' : '')"
  28. >
  29. <img :src="logoSrc" :alt="logoAlt" />
  30. </div>
  31. <div class="image-text mt-12">
  32. <slot name="watermark" />
  33. </div>
  34. </div>
  35. </v-col>
  36. </v-row>
  37. </LayoutContainer>
  38. </template>
  39. <script setup lang="ts">
  40. import type { PropType } from 'vue'
  41. import { useLayoutStore } from '~/stores/layoutStore'
  42. defineProps({
  43. imageSrc: {
  44. type: String,
  45. required: true,
  46. },
  47. imageAlt: {
  48. type: String,
  49. default: '',
  50. },
  51. squareText: {
  52. type: String,
  53. default:
  54. "École de musique, d'art, de danse, de cirque, conservatoires et MJC",
  55. },
  56. logoSrc: {
  57. type: String as PropType<string | null>,
  58. required: false,
  59. default: null,
  60. },
  61. logoAlt: {
  62. type: String,
  63. required: false,
  64. default: '',
  65. },
  66. logoAltTheme: {
  67. type: Boolean,
  68. default: false,
  69. },
  70. reverseImage: {
  71. type: Boolean,
  72. default: false,
  73. },
  74. })
  75. const layoutStore = useLayoutStore()
  76. const onIntersect = (isIntersecting: boolean) => {
  77. layoutStore.setIsBannerVisible(isIntersecting)
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. .banner-container {
  82. position: relative;
  83. overflow: hidden;
  84. min-height: 400px;
  85. max-height: 400px;
  86. .image-text {
  87. position: absolute;
  88. top: 40px;
  89. left: 20px;
  90. color: white;
  91. font-size: 3rem;
  92. width: 30rem;
  93. font-style: italic;
  94. font-weight: 300;
  95. line-height: 40px;
  96. }
  97. @media (max-width: 600px) {
  98. min-height: 0;
  99. }
  100. }
  101. .cover-image {
  102. width: 100%;
  103. min-height: 400px;
  104. max-height: 400px;
  105. object-fit: cover;
  106. object-position: center var(--banner-center-image);
  107. transition: transform 0.2s;
  108. margin: 0 auto;
  109. @media (max-width: 600px) {
  110. min-height: 235px;
  111. }
  112. }
  113. .reverse {
  114. transform: scaleX(-1);
  115. }
  116. .custom-icon {
  117. width: 3rem;
  118. height: 3rem;
  119. margin-top: 0.5rem;
  120. }
  121. .details-square {
  122. position: absolute;
  123. bottom: 0;
  124. right: 0;
  125. width: 13rem;
  126. height: 10rem;
  127. background: var(--secondary-color);
  128. @media (max-width: 600px) {
  129. width: 50%;
  130. }
  131. }
  132. .logo-square {
  133. position: absolute;
  134. bottom: 0;
  135. right: 13rem;
  136. width: 13rem;
  137. height: 10rem;
  138. img {
  139. width: 100%;
  140. margin-top: 2.5rem;
  141. }
  142. @media (max-width: 600px) {
  143. right: 50%;
  144. width: 50%;
  145. }
  146. }
  147. .logo-square:not(.alt-theme) {
  148. background: var(--primary-color);
  149. }
  150. .description {
  151. color: var(--on-secondary-color);
  152. font-weight: 300;
  153. font-size: 0.8rem;
  154. text-align: center;
  155. display: flex;
  156. align-items: center;
  157. margin: 0.5rem 2rem 1rem;
  158. }
  159. .content-row {
  160. margin-top: 2rem;
  161. display: flex;
  162. flex-direction: column;
  163. justify-content: space-around;
  164. align-items: center;
  165. height: 100%;
  166. }
  167. .icon {
  168. margin-left: 2rem;
  169. margin-right: 2rem;
  170. }
  171. </style>