Banner.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. }
  98. .cover-image {
  99. width: 100%;
  100. min-height: 400px;
  101. max-height: 400px;
  102. object-fit: cover;
  103. object-position: center var(--banner-center-image);
  104. transition: transform 0.2s;
  105. margin: 0 auto;
  106. @media (max-width: 600px) {
  107. min-height: 0;
  108. }
  109. }
  110. .reverse {
  111. transform: scaleX(-1);
  112. }
  113. .custom-icon {
  114. width: 3rem;
  115. height: 3rem;
  116. margin-top: 0.5rem;
  117. }
  118. .details-square {
  119. position: absolute;
  120. bottom: 0;
  121. right: 0;
  122. width: 13rem;
  123. height: 10rem;
  124. background: var(--secondary-color);
  125. @media (max-width: 600px) {
  126. width: 50%;
  127. }
  128. }
  129. .logo-square {
  130. position: absolute;
  131. bottom: 0;
  132. right: 13rem;
  133. width: 13rem;
  134. height: 10rem;
  135. img {
  136. width: 100%;
  137. height: 50%;
  138. margin-top: 2.5rem;
  139. }
  140. @media (max-width: 600px) {
  141. right: 50%;
  142. width: 50%;
  143. }
  144. }
  145. .logo-square:not(.alt-theme) {
  146. background: var(--primary-color);
  147. }
  148. .description {
  149. color: var(--on-secondary-color);
  150. font-weight: 300;
  151. font-size: 0.8rem;
  152. text-align: center;
  153. display: flex;
  154. align-items: center;
  155. margin: 0.5rem 2rem 1rem;
  156. }
  157. .content-row {
  158. margin-top: 2rem;
  159. display: flex;
  160. flex-direction: column;
  161. justify-content: space-around;
  162. align-items: center;
  163. height: 100%;
  164. }
  165. .icon {
  166. margin-left: 2rem;
  167. margin-right: 2rem;
  168. }
  169. </style>