<template>
  <LayoutContainer>
    <v-row>
      <v-col cols="12">
        <div class="banner-container">
          <img
            :src="imageSrc"
            :alt="imageAlt"
            :class="['cover-image', reverseImage ? 'reverse' : '']"
          />

          <div v-if="logoSrc" class="details-square">
            <v-row>
              <div class="content-row">
                <img
                  src="/images/logiciels/icons/la-musique.svg"
                  alt="icon instrument de musique"
                  class="custom-icon"
                />
                <p class="description">
                  {{ squareText }}
                </p>
              </div>
            </v-row>
          </div>

          <div v-if="logoSrc" :class="'logo-square' + (logoAltTheme ? ' alt-theme' : '')">
            <img :src="logoSrc" :alt="logoAlt"/>
          </div>

          <div class="image-text mt-12">
            <slot name="watermark" />
          </div>
        </div>
      </v-col>
    </v-row>
  </LayoutContainer>
</template>

<script setup lang="ts">

const props = defineProps({
  imageSrc: {
    type: String,
    required: true
  },
  imageAlt: {
    type: String,
    default: ""
  },
  squareText: {
    type: String,
    default: "École de musique, d'art, de danse, de cirque, conservatoires et MJC"
  },
  logoSrc: {
    type: String as PropType<string | null>,
    required: false,
    default: null
  },
  logoAlt: {
    type: String,
    required: false,
    default: ""
  },
  logoAltTheme: {
    type: Boolean,
    default: false
  },
  reverseImage: {
    type: Boolean,
    default: false
  }
});
</script>

<style scoped lang="scss">
.banner-container {
  position: relative;
  overflow: hidden;

  .image-text {
    position: absolute;
    top: 40px;
    left: 20px;
    color: white;
    font-size: 3rem;
    width: 30rem;
    font-style: italic;
    font-weight: 300;
    line-height: 40px;
  }
}

.cover-image {
  width: 100%;
  min-height: 400px;
  max-height: 400px;
  object-fit: cover;
  object-position: center var(--banner-center-image);
  transition: transform 0.2s;
  margin: 0 auto;
}

.reverse {
  transform: scaleX(-1);
}

.custom-icon {
  width: 3rem;
  height: 3rem;
  margin-top: .5rem;
}

.details-square {
  position: absolute;
  bottom: 0.4rem;
  right: 0;
  width: 13rem;
  height: 10rem;
  background: var(--secondary-color);
}

.logo-square {
  position: absolute;
  bottom: 0;
  right: 13rem;
  width: 13rem;
  height: 10.4rem;

  img {
    width: 100%;
    height: 50%;
    margin-top: 2.5rem;
  }
}
.logo-square:not(.alt-theme) {
  background: var(--primary-color);
}

.description {
  color: var(--on-secondary-color);
  font-weight: 300;
  font-size: 0.8rem;
  text-align: center;
  display: flex;
  align-items: center;
  margin: 0.5rem 2rem 1rem;
}

.content-row {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}

.icon {
  margin-left: 2rem;
  margin-right: 2rem;
}
</style>
