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

237 lines
5.8 KiB
Vue

<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref } from "vue";
import { Icon } from "@iconify/vue";
const { t } = useI18n();
const techStackRef = ref<HTMLElement | null>(null);
let observer: IntersectionObserver | null = null;
const categories = computed(() => [
{
title: t("techStack.frontend"),
items: [
{ name: "Vue.js", icon: "simple-icons:vuedotjs" },
{ name: "Nuxt.js", icon: "simple-icons:nuxtdotjs" },
{ name: "React.js", icon: "simple-icons:react" },
{ name: "TailwindCSS", icon: "simple-icons:tailwindcss" },
{ name: "Bootstrap", icon: "simple-icons:bootstrap" },
],
},
{
title: t("techStack.backend"),
items: [
{ name: "Laravel", icon: "simple-icons:laravel" },
{ name: "Express.js", icon: "simple-icons:express" },
{ name: "REST API", icon: "lucide:braces" },
{ name: "Sanctum", icon: "lucide:shield-check" },
{ name: "JWT", icon: "lucide:key-round" },
],
},
{
title: t("techStack.database"),
items: [
{ name: "MySQL", icon: "simple-icons:mysql" },
{ name: "MariaDB", icon: "simple-icons:mariadb" },
],
},
{
title: t("techStack.infrastructure"),
items: [
{ name: "MikroTik", icon: "simple-icons:mikrotik" },
{ name: "Linux", icon: "simple-icons:linux" },
{ name: "Docker", icon: "simple-icons:docker" },
{ name: "Nginx", icon: "simple-icons:nginx" },
{ name: "WireGuard", icon: "simple-icons:wireguard" },
{ name: "Cloudflare", icon: "simple-icons:cloudflare" },
{ name: "DNS", icon: "lucide:globe-2" },
{ name: "TCP/IP", icon: "lucide:network" },
],
},
]);
onMounted(() => {
if (!techStackRef.value) return;
observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
entry.target.classList.toggle(
"is-visible",
entry.isIntersecting,
);
});
},
{
threshold: 0.12,
rootMargin: "0px 0px -50px 0px",
},
);
techStackRef.value
.querySelectorAll("[data-reveal]")
.forEach((element) => observer?.observe(element));
});
onBeforeUnmount(() => {
observer?.disconnect();
});
</script>
<template>
<section
id="tech-stack"
ref="techStackRef"
class="relative overflow-hidden py-16 sm:py-20 lg:py-24"
>
<div class="mx-auto w-full max-w-7xl px-5 sm:px-8 lg:px-10">
<div
data-reveal
class="reveal mx-auto mb-10 max-w-3xl text-center sm:mb-14 lg:mb-16"
>
<span
class="inline-flex items-center rounded-full border px-3 py-1.5 text-[10px] font-medium sm:px-4 sm:py-2 sm:text-sm"
:style="{
backgroundColor: 'var(--surface)',
borderColor: 'var(--border)',
color: 'var(--text-muted)',
}"
>
{{ t("techStack.badge") }}
</span>
<h2
class="mt-4 text-3xl font-bold tracking-[-0.04em] sm:mt-6 sm:text-4xl md:text-5xl"
>
{{ t("techStack.title") }}
</h2>
<p
class="mx-auto mt-3 max-w-2xl text-sm leading-6 sm:mt-5 sm:text-lg sm:leading-7"
style="color: var(--text-muted)"
>
{{ t("techStack.description") }}
</p>
</div>
<div class="grid gap-4 sm:gap-6 lg:grid-cols-2 lg:gap-7">
<article
v-for="(category, index) in categories"
:key="category.title"
data-reveal
class="reveal rounded-2xl border p-5 sm:rounded-3xl sm:p-7 lg:p-8"
:style="{
'--delay': `${index * 100}ms`,
backgroundColor: 'var(--surface)',
borderColor: 'var(--border)',
}"
>
<div class="mb-5 flex items-center justify-between sm:mb-6">
<h3
class="text-lg font-bold tracking-tight sm:text-2xl"
>
{{ category.title }}
</h3>
<span
class="font-mono text-[9px] text-(--text-muted) sm:text-[10px]"
>
{{ String(index + 1).padStart(2, "0") }}
</span>
</div>
<div class="flex flex-wrap gap-2 sm:gap-3">
<span
v-for="item in category.items"
:key="item.name"
class="tech-badge"
>
<Icon
:icon="item.icon"
class="h-4 w-4 shrink-0"
/>
<span>{{ item.name }}</span>
</span>
</div>
</article>
</div>
</div>
</section>
</template>
<style scoped>
.reveal {
opacity: 0;
transform: translate3d(0, 30px, 0);
transition:
opacity 650ms cubic-bezier(0.22, 1, 0.36, 1),
transform 650ms 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);
}
.tech-badge {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 7px 12px;
border-radius: 999px;
border: 1px solid var(--border);
background: var(--bg);
color: var(--text-muted);
font-size: 0.75rem;
line-height: 1.2;
transition:
transform 300ms ease,
border-color 300ms ease,
color 300ms ease,
background-color 300ms ease;
}
.tech-badge:hover {
transform: translateY(-2px);
border-color: var(--primary);
color: var(--text);
}
.tech-badge :deep(svg) {
width: 15px;
height: 15px;
}
@media (max-width: 639px) {
.reveal {
transform: translate3d(0, 22px, 0);
transition-duration: 580ms;
}
.tech-badge {
gap: 6px;
padding: 6px 10px;
font-size: 0.7rem;
}
.tech-badge :deep(svg) {
width: 14px;
height: 14px;
}
}
@media (prefers-reduced-motion: reduce) {
.reveal {
opacity: 1;
transform: none;
transition: none;
}
.tech-badge {
transition: none;
}
}
</style>