МÐНоÐСоздан компоент Steps

This commit is contained in:
Web-serfer 2026-04-04 16:18:55 +05:00
parent d5286ab980
commit 00f9b24a60
9 changed files with 1420 additions and 184 deletions

View file

@ -0,0 +1,399 @@
---
import Button from '@components/base/Button.astro';
interface Step {
number: number;
title: string;
description: string;
icon: string;
}
const {
sectionSubtitle = "ПРОСТОЙ ПРОЦЕСС",
sectionTitle = "Как мы работаем",
steps = [
{
number: 1,
title: "Бесплатная консультация",
description: "Позвоните или оставьте заявку. Разберём вашу ситуацию и оценим перспективы дела.",
icon: "📞"
},
{
number: 2,
title: "Анализ документов",
description: "Изучим протоколы, постановления и материалы дела. Найдём слабые места.",
icon: "📋"
},
{
number: 3,
title: "Разработка стратегии",
description: "Подберём оптимальную тактику защиты с учётом практики судов Сургута.",
icon: "🎯"
},
{
number: 4,
title: "Достижение результата",
description: "Представим ваши интересы в суде или ГИБДД. Добьёмся победы.",
icon: "🏆"
}
] as Step[]
} = Astro.props;
---
<section class="steps-section" id="how-we-work">
<div class="site-container">
<!-- Заголовок секции -->
<div class="section-header">
<span class="subtitle animate-on-scroll" data-animation="fade-up">{sectionSubtitle}</span>
<h2 class="title animate-on-scroll" data-animation="fade-up" data-delay="100">{sectionTitle}</h2>
</div>
<!-- Шаги -->
<div class="steps-grid">
{steps.map((step, index) => (
<div class="step-card animate-on-scroll" data-animation="fade-up" data-delay={index * 150 + 200}>
<!-- Номер шага -->
<div class="step-number-wrapper">
<div class="step-number">{step.number}</div>
{index < steps.length - 1 && (
<div class="step-connector"></div>
)}
</div>
<!-- Контент -->
<div class="step-content">
<div class="step-icon">
<span class="icon-emoji">{step.icon}</span>
</div>
<h3 class="step-title">{step.title}</h3>
<p class="step-description">{step.description}</p>
</div>
</div>
))}
</div>
<!-- Кнопка CTA -->
<div class="steps-cta animate-on-scroll" data-animation="fade-up" data-delay="800">
<Button variant="gold" size="lg" id="consultation-btn" data-modal-target="consultation-modal">
<span class="cta-text">Начать консультацию бесплатно</span>
<svg class="cta-arrow" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 12h14M12 5l7 7-7 7"/>
</svg>
</Button>
</div>
</div>
</section>
<style>
:root {
--color-primary: #1e3050;
--color-accent: #eac26e;
--color-accent-light: #ce9f40;
--color-light: #f8fafc;
--color-gray: #64748b;
}
.steps-section {
padding: 6rem 1.5rem;
background: linear-gradient(180deg, #0b1426 0%, #1e3050 100%);
font-family: 'Inter', system-ui, -apple-system, sans-serif;
overflow: hidden;
}
.site-container {
max-width: var(--site-max-width, 1400px);
margin: 0 auto;
}
/* Заголовок секции */
.section-header {
margin-bottom: 4rem;
text-align: center;
}
.subtitle {
display: inline-block;
color: #eac26e;
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 3px;
margin-bottom: 1rem;
padding: 0.5rem 1rem;
background: rgba(234, 194, 110, 0.15);
border-radius: 6px;
}
.title {
color: #ffffff;
font-size: clamp(2rem, 4vw, 3rem);
font-weight: 800;
margin: 0;
line-height: 1.2;
letter-spacing: -0.02em;
}
/* --- АНИМАЦИИ ПРИ СКРОЛЛИНГЕ --- */
.animate-on-scroll {
opacity: 0;
will-change: opacity, transform;
}
[data-animation="fade-up"] {
transform: translateY(30px);
transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.animate-on-scroll.is-visible {
opacity: 1;
transform: translateY(0);
}
/* Сетка шагов */
.steps-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 2rem;
margin-bottom: 4rem;
}
/* Карточка шага */
.step-card {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
/* Номер шага */
.step-number-wrapper {
position: relative;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1.5rem;
}
.step-number {
width: 60px;
height: 60px;
border-radius: 50%;
background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
color: #ffffff;
font-size: 1.5rem;
font-weight: 900;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8px 25px rgba(234, 194, 110, 0.3);
position: relative;
z-index: 2;
}
/* Соединительная линия */
.step-connector {
position: absolute;
top: 50%;
left: calc(50% + 40px);
width: calc(100% - 80px);
height: 2px;
background: linear-gradient(90deg, var(--color-accent) 0%, rgba(234, 194, 110, 0.2) 100%);
z-index: 1;
}
/* Иконка шага */
.step-icon {
width: 64px;
height: 64px;
background: rgba(255, 255, 255, 0.08);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1.5rem;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.step-card:hover .step-icon {
transform: translateY(-4px);
background: rgba(234, 194, 110, 0.15);
box-shadow: 0 8px 25px rgba(234, 194, 110, 0.2);
}
.icon-emoji {
font-size: 2rem;
line-height: 1;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
transition: transform 0.3s ease;
display: inline-block;
}
.step-card:hover .icon-emoji {
transform: scale(1.1);
}
/* Текст шага */
.step-content {
width: 100%;
}
.step-title {
font-size: 1.25rem;
font-weight: 700;
color: #ffffff;
margin: 0 0 0.75rem 0;
line-height: 1.3;
}
.step-description {
font-size: 0.95rem;
line-height: 1.7;
color: rgba(255, 255, 255, 0.7);
margin: 0;
}
/* CTA кнопка */
.steps-cta {
text-align: center;
}
.steps-cta .btn {
display: inline-flex;
align-items: center;
gap: 0.75rem;
padding: 1rem 2rem;
font-size: 1.1rem;
font-weight: 700;
border-radius: 8px;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 8px 25px rgba(234, 194, 110, 0.3);
text-transform: uppercase;
letter-spacing: 0.5px;
position: relative;
overflow: hidden;
}
.steps-cta .btn:hover {
transform: translateY(-3px);
box-shadow: 0 12px 35px rgba(234, 194, 110, 0.4);
opacity: 0.95;
}
.steps-cta .btn:active {
transform: translateY(-1px);
}
.cta-arrow {
transition: transform 0.3s ease;
}
.steps-cta .btn:hover .cta-arrow {
transform: translateX(4px);
}
/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 1024px) {
.steps-grid {
grid-template-columns: repeat(2, 1fr);
gap: 3rem;
}
.step-connector {
display: none;
}
}
@media (max-width: 768px) {
.steps-section {
padding: 4rem 1rem;
}
.steps-grid {
grid-template-columns: 1fr;
gap: 2.5rem;
}
.step-card {
text-align: left;
align-items: flex-start;
}
.step-number-wrapper {
justify-content: flex-start;
margin-bottom: 1rem;
}
.step-number {
width: 50px;
height: 50px;
font-size: 1.25rem;
}
.step-icon {
width: 56px;
height: 56px;
}
.icon-emoji {
font-size: 1.75rem;
}
.step-title {
font-size: 1.15rem;
}
.step-description {
font-size: 0.9rem;
}
.steps-cta .btn {
width: 100%;
justify-content: center;
padding: 0.875rem 1.5rem;
font-size: 1rem;
min-height: 3.25rem;
}
}
/* Уважаем prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
.animate-on-scroll {
opacity: 1;
transform: none;
transition: none;
}
}
</style>
<script>
// Intersection Observer для анимаций при скроллинге
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.15
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const el = entry.target as HTMLElement;
const delay = parseInt(el.dataset.delay || '0');
setTimeout(() => {
el.classList.add('is-visible');
}, delay);
observer.unobserve(el);
}
});
}, observerOptions);
// Наблюдаем за всеми анимируемыми элементами
document.querySelectorAll('.animate-on-scroll').forEach((el) => {
observer.observe(el);
});
</script>