web-difarft/app/components/sections/home/AboutSection.vue

194 lines
4.9 KiB
Vue

<script setup lang="ts">
import { onMounted, onBeforeUnmount, ref } from "vue";
const { t } = useI18n();
const aboutRef = ref<HTMLElement | null>(null);
let observer: IntersectionObserver | null = null;
onMounted(() => {
if (!aboutRef.value) return;
observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("is-visible");
} else {
entry.target.classList.remove("is-visible");
}
});
},
{
threshold: 0.15,
rootMargin: "0px 0px -40px 0px",
},
);
aboutRef.value
.querySelectorAll("[data-reveal]")
.forEach((element) => observer?.observe(element));
});
onBeforeUnmount(() => {
observer?.disconnect();
});
</script>
<template>
<section
id="about"
ref="aboutRef"
class="relative overflow-hidden py-16 sm:py-20 lg:py-28"
>
<div class="mx-auto max-w-7xl px-5 sm:px-8 lg:px-10">
<!-- Badge -->
<div
data-reveal
data-direction="bottom"
class="reveal mb-10 flex justify-center sm:mb-14"
>
<span
class="inline-flex rounded-full border border-(--border) bg-(--surface) px-3 py-1.5 text-xs font-medium text-(--text) sm:px-4 sm:py-2 sm:text-sm"
>
{{ t("about.badge") }}
</span>
</div>
<div
class="grid items-center gap-10 sm:gap-12 lg:grid-cols-[0.85fr_1.15fr] lg:gap-20"
>
<!-- Photo -->
<div
data-reveal
data-direction="bottom"
class="reveal flex justify-center"
style="--delay: 100ms"
>
<div
class="aspect-4/5 w-full max-w-70 overflow-hidden rounded-2xl border border-(--border) bg-(--surface) sm:max-w-sm lg:max-w-none"
>
<img
src="/img/foto.jpeg"
:alt="t('about.name')"
width="899"
height="1126"
loading="lazy"
decoding="async"
class="h-full w-full object-cover transition-transform duration-700 hover:scale-[1.02]"
/>
</div>
</div>
<!-- Content -->
<div class="min-w-0 text-left">
<div
data-reveal
data-direction="bottom"
class="reveal"
style="--delay: 180ms"
>
<div
class="mb-3 font-mono text-[10px] uppercase tracking-[0.28em] text-(--text-muted) sm:mb-4"
>
WHO AM I
</div>
<h2
class="text-3xl font-semibold leading-tight tracking-[-0.035em] text-(--text) sm:text-4xl lg:text-5xl"
>
{{ t("about.title") }}
</h2>
</div>
<div
data-reveal
data-direction="bottom"
class="reveal mt-5 max-w-2xl space-y-4 text-sm leading-6 text-(--text-muted) sm:mt-7 sm:space-y-5 sm:text-base sm:leading-7 lg:mx-0 lg:text-lg lg:leading-8"
style="--delay: 280ms"
>
<p>
{{ t("about.paragraph1") }}
</p>
<p>
{{ t("about.paragraph2") }}
</p>
</div>
<!-- Info -->
<div
data-reveal
data-direction="bottom"
class="reveal mx-auto mt-7 grid max-w-xl grid-cols-2 gap-3 sm:mt-9 lg:mx-0"
style="--delay: 380ms"
>
<div
class="rounded-xl border border-(--border) bg-(--surface) px-3 py-3.5 sm:px-4 sm:py-4"
>
<div
class="font-mono text-[9px] uppercase tracking-[0.2em] text-(--text-muted)"
>
Focus
</div>
<div class="mt-2 text-xs font-medium text-(--text) sm:text-base">
Web & Backend
</div>
</div>
<div
class="rounded-xl border border-(--border) bg-(--surface) px-3 py-3.5 sm:px-4 sm:py-4"
>
<div
class="font-mono text-[9px] uppercase tracking-[0.2em] text-(--text-muted)"
>
Also
</div>
<div class="mt-2 text-xs font-medium text-(--text) sm:text-base">
Network & System
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</template>
<style scoped>
.reveal {
opacity: 0;
transform: translate3d(0, 30px, 0);
transition:
opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
transition-delay: var(--delay, 0ms);
will-change: opacity, transform;
}
.reveal.is-visible {
opacity: 1;
transform: translate3d(0, 0, 0);
}
@media (min-width: 640px) {
.reveal {
transform: translate3d(0, 35px, 0);
}
}
@media (prefers-reduced-motion: reduce) {
.reveal {
opacity: 1;
transform: none !important;
transition: none;
}
}
</style>