Banner.vue 3.5 KB

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