<template>
  <PageMeta
      title="Olivier Massot - Fullstack developer"
      description=""
  />

  <div class="banner">
    <h1>
      {{ $t('Fullstack developer') }}
    </h1>

    <h2>
      {{ $t('x_years_experience', { years: XP_YEARS }) }}
    </h2>
  </div>

  <v-card class="introduction">
    <div>
      {{ $t('intro_short') }}
    </div>

    <div v-html="$t('intro_part_4')" />

    <v-expand-transition>
      <div v-if="showLongIntro" class="long-intro">
        <div>
          {{ $t('intro_part_1') }}
        </div>

        <div>
          {{ $t('intro_part_2') }}
        </div>

        <div>
          {{ $t('intro_part_3') }}
        </div>
      </div>
    </v-expand-transition>

    <v-btn
      size="small"
      variant="text"
      :prepend-icon="showLongIntro ? 'fas fa-caret-up' : 'fas fa-caret-down'"
      :height="36"
      @click="showLongIntro=!showLongIntro"
    >
      {{ showLongIntro ? $t('show_less') : $t('show_more') }}
    </v-btn>

    <div class="banner-buttons">
      <DownloadPdfBtn />

      <v-btn variant="outlined" to="#contact" :active="false">
        {{$t('contact_me')}}
      </v-btn>
    </div>

    <h5 class="find-me-on">
      {{ $t('find_me_on')}}
    </h5>

    <div class="logos mt-2">
      <BannerLogo
        href="https://github.com/olinox14"
        :img="theme.global.name.value === 'light' ? '/images/logos/github_large_light.png' : '/images/logos/github_large_dark.png'"
        :alt="i18n.t('Find me on Github')"
      />

      <BannerLogo
        href="https://stackoverflow.com/users/4279120/olinox14"
        :img="theme.global.name.value === 'light' ? '/images/logos/stackoverflow.svg' : '/images/logos/stackoverflow-dark.svg'"
        :alt="i18n.t('Find me on Stackoverflow')"
        :height="30"
      />

      <BannerLogo
        href="https://www.linkedin.com/in/olivier-massot-60b87b181"
        img="/images/logos/linkedin.png"
        :alt="i18n.t('Find me on LinkedIn')"
        :height="22"
      />

      <BannerLogo
        href="https://www.codingame.com/profile/75dcc329745def530c02ddb4485f22235683081"
        img="/images/logos/codingame.svg"
        :alt="i18n.t('Find me on Codingame')"
      />
    </div>
  </v-card>

  <div class="content">
    <div class="badges">
      <h3>{{ $t("Competences") }}</h3>

      <BadgeSection />
    </div>

    <div class="cursus">
      <h3>{{ $t("Cursus") }}</h3>

      <Cursus />
    </div>
  </div>

  <div id="contact">
    <h3>{{ $t("Contact") }}</h3>

    <Contact />
  </div>
</template>

<script setup lang="ts">

import { useTheme } from 'vuetify'
import type { Ref } from '@vue/reactivity'
import BadgeSection from '~/components/BadgeSection.vue'

const i18n = useI18n()

const theme = useTheme()

const START_YEAR = 2011
const CURRENT_YEAR = new Date().getFullYear();

const XP_YEARS = CURRENT_YEAR - START_YEAR

const showLongIntro: Ref<boolean> = ref(false)
</script>

<style scoped lang="scss">
.banner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  color: rgb(var(--v-theme-on-background));

  h2 {
    margin: 18px 0 36px 0;
    border-bottom: none;
  }
}

.introduction {
  padding: 36px 64px;
  border-radius: 6px;
  text-align: justify;
  margin: 0 auto;
  width: 100%;

  @media (max-width: 600px) {
    padding: 36px 10%;
  }

  :deep(a) {
    color: rgb(var(--v-theme-on-primary--clickable));
  }

  div {
    max-width: 900px;
    margin: 0 auto 16px auto;
  }

  .v-btn {
    width: 100%;
    margin: 2px auto 16px auto;
  }

  :deep(a) {
    font-weight: 900;
    text-decoration: none;
    padding: 3px 1px;
  }

  .banner-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;

    .v-btn {
      margin: 6px 24px;
      width: 160px;
      border-radius: 18px;
      font-weight: 500;
    }

    @media (max-width: 600px) {
      flex-direction: column;
      align-items: center;

      .v-btn {
        margin: 12px auto;
      }
    }
  }

  .find-me-on {
    margin: 16px auto 0 auto;
    text-transform: uppercase;
    text-align: center;
    font-size: 12px;
    font-weight: 400;
  }

  .logos {
    display: flex;
    flex-direction: row;
    max-width: 600px;
    margin: 0 auto;
    justify-content: center;
    align-items: center;

    @media (max-width: 540px) {
      flex-direction: column;
    }
  }
}

h3 {
  margin: 12px 0 24px 0;
}

.content {
  display: flex;
  flex-direction: row;
  justify-content: space-around;

  .badges {
    max-width: 65%;
    min-width: 65%;
  }

  .cursus {
    max-width: 35%;
    min-width: 35%;
    padding: 24px;
  }

  @media (max-width: 1280px) {
    flex-direction: column;

    .badges {
      max-width: 100%;
    }

    .cursus {
      max-width: 100%;
    }
  }
}

.badges {
  padding: 18px;
}
</style>