paulnicoue/components/HeroTitle.vue

122 lines
2.7 KiB
Vue
Raw Normal View History

2023-01-20 18:08:51 +01:00
<template>
<h1 class="hero-title">
<Transition name="fade-in-from-bottom">
<div class="hero-title__name" v-show="isVisible">Paul Nicoué</div>
</Transition>
<Transition name="expand-width">
<div class="hero-title__separator" aria-hidden="true" v-show="isVisible"></div>
</Transition>
<Transition name="fade-in-from-top">
<div class="hero-title__job" v-show="isVisible">Intégrateur web & développeur full stack</div>
</Transition>
</h1>
2023-01-20 18:08:51 +01:00
</template>
<script setup>
// --------------------------------------------------
// DATA
// --------------------------------------------------
const isVisible = ref(false);
// --------------------------------------------------
// PROGRAM
// --------------------------------------------------
onMounted(() => {
isVisible.value = true;
})
2023-01-20 18:08:51 +01:00
</script>
<style lang="scss" scoped>
// --------------------------------------------------
// STYLE
// --------------------------------------------------
.hero-title {
width: 100%;
display: grid;
grid:
'name' auto
'separator' auto
'job' auto
/ minmax(50%, auto);
place-content: center;
place-items: center;
gap: 0.5rem;
2023-01-20 18:08:51 +01:00
text-align: center;
&__name {
grid-area: name;
2023-01-20 18:08:51 +01:00
margin: 0 2rem;
}
&__separator {
grid-area: separator;
width: 100%;
2023-01-20 18:08:51 +01:00
height: 1px;
background-color: var(--accent-color);
}
&__job {
grid-area: job;
2023-01-20 18:08:51 +01:00
font-size: var(--h2-font-size);
font-weight: var(--light-font-weight);
margin: 0 2rem;
}
}
// Transition components
.fade-in-from-bottom {
&-enter-from,
&-leave-to {
opacity: 0;
transform: translateY(0.25rem);
}
&-enter-active,
&-leave-active {
transition:
opacity 400ms ease-in-out 600ms,
transform 400ms ease-in-out 600ms;
}
}
.fade-in-from-top {
&-enter-from,
&-leave-to {
opacity: 0;
transform: translateY(-0.25rem);
}
&-enter-active,
&-leave-active {
transition:
opacity 400ms ease-in-out 600ms,
transform 400ms ease-in-out 600ms;
}
}
.expand-width {
&-enter-from,
&-leave-to {
width: 0;
}
&-enter-active,
&-leave-active {
transition: width 400ms ease-in-out 200ms;
2023-01-20 18:08:51 +01:00
}
}
</style>