Создание страницы - Контакты

This commit is contained in:
Web-serfer 2026-04-06 20:59:50 +05:00
parent 6828b990a9
commit f84c24e91f
11 changed files with 1733 additions and 75 deletions

View file

@ -1,31 +1,14 @@
---
// Данные отзывов
const reviews = [
{
name: "Алексей М.",
car: "Toyota Camry",
text: "Помогли вернуть права после того, как инспектор незаконно составил протокол за встречку. Юрист нашел кучу ошибок в схеме ДТП. Огромное спасибо!",
initial: "А",
color: "bg-blue-100 text-blue-600"
},
{
name: "Екатерина П.",
car: "Hyundai Solaris",
text: "Страховая выплатила копейки по ОСАГО. Обратилась сюда, сделали независимую экспертизу и через суд взыскали еще 120 тысяч. Профессионалы!",
initial: "Е",
color: "bg-teal-100 text-teal-600"
},
{
name: "Игорь С.",
car: "Lexus RX",
text: "Грамотно разобрали сложное ДТП на перекрестке. Доказали, что я не виноват, хотя ГИБДД изначально решило иначе. Лучшие в Сургуте.",
initial: "И",
color: "bg-orange-100 text-orange-600"
}
];
import { reviewsData } from '@data/reviewsData';
import ReviewCard from '@components/reviews/ReviewCard.astro';
// Берём 6 последних отзывов (сортируем по дате, берём последние)
const latestReviews = [...reviewsData]
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
.slice(0, 6);
// Для эффекта бесконечности клонируем элементы (один набор в начало, один в конец)
const displayReviews = [...reviews, ...reviews, ...reviews];
const displayReviews = [...latestReviews, ...latestReviews, ...latestReviews];
---
<section class="reviews-section py-16 bg-[#ffffff] overflow-hidden">
@ -45,29 +28,24 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
<!-- Окно просмотра -->
<div id="sliderContainer" class="overflow-x-hidden scroll-smooth">
<div id="sliderTrack" class="flex gap-6 py-4">
<div id="sliderTrack" class="flex gap-6 py-4 items-stretch">
{displayReviews.map((review, index) => (
<div class="card-item min-w-full md:min-w-[calc(33.333%-1rem)] bg-white p-8 rounded-2xl shadow-sm border border-slate-100 flex flex-col justify-between select-none animate-on-scroll" data-animation="scale-up" data-delay={index * 100 + 300}>
<div>
<div class="flex gap-1 mb-5">
{[...Array(5)].map(() => (
<svg class="w-5 h-5 text-[#fbbf24] fill-current" viewBox="0 0 20 20"><path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" /></svg>
))}
</div>
<p class="text-slate-700 leading-relaxed italic text-[15px] mb-8">
"{review.text}"
</p>
</div>
<div class="flex items-center gap-4">
<div class={`w-12 h-12 rounded-xl flex items-center justify-center font-bold text-lg shrink-0 ${review.color}`}>
{review.initial}
</div>
<div class="text-left">
<h4 class="font-bold text-[#1e293b] leading-tight">{review.name}</h4>
<p class="text-sm text-slate-400">{review.car}</p>
</div>
</div>
<div
class="card-item min-w-full md:min-w-[calc(33.333%-1rem)] select-none animate-on-scroll"
data-animation="scale-up"
data-delay={index * 100 + 300}
>
<ReviewCard
name={review.name}
car={review.car}
text={review.text}
rating={review.rating}
initial={review.initial}
color={review.color}
date={review.date}
votesCount={review.votesCount || 0}
isHelpful={review.isHelpful || false}
/>
</div>
))}
</div>
@ -82,7 +60,7 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
</section>
<style>
/* Скрываем скроллбар для всех браузеров */
/* Скрываем скроллбар */
#sliderContainer {
-ms-overflow-style: none;
scrollbar-width: none;
@ -91,12 +69,24 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
display: none;
}
/* Плавный скролл snap-эффект */
/* Карточка в слайдере — полностью сохраняет оригинальный дизайн ReviewCard */
.card-item {
scroll-snap-align: center;
display: flex;
}
/* --- ЗАГОЛОВОК СЕКЦИИ (как в Services) --- */
/* Убедимся, что карточка растягивается на всю ширину слайда */
.card-item :global(.review-card) {
width: 100%;
margin: 0;
}
/* Уменьшаем имя для слайдера — влезает в одну строку */
.card-item :global(.author-name) {
font-size: 0.9rem;
}
/* Заголовок секции */
.section-header {
margin-bottom: 4rem;
text-align: center;
@ -128,38 +118,33 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
width: 100%;
}
/* --- АНИМАЦИИ ПРИ СКРОЛЛИНГЕ --- */
/* Анимации при скроллинге */
.animate-on-scroll {
opacity: 0;
will-change: opacity, transform;
}
/* Fade Up - для заголовка */
[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);
}
/* Fade In - для кнопок */
[data-animation="fade-in"] {
transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Scale Up - для карточек */
[data-animation="scale-up"] {
transform: translateY(40px) scale(0.95);
transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Активное состояние */
.animate-on-scroll.is-visible {
opacity: 1;
transform: translateY(0) scale(1);
}
/* Уважаем prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
.animate-on-scroll {
opacity: 1;
@ -170,7 +155,7 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
</style>
<script>
// Intersection Observer для анимаций при скроллинге
// Intersection Observer для анимаций
const setupAnimations = () => {
const observerOptions = {
root: null,
@ -205,13 +190,12 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
const prevBtn = document.getElementById('prevBtn');
const cards = document.querySelectorAll('.card-item');
if (!container || !track || !nextBtn || !prevBtn) return;
if (!container || !track || !nextBtn || !prevBtn || cards.length === 0) return;
const totalOriginal = cards.length / 3; // Так как мы отрисовали массив 3 раза
const totalOriginal = cards.length / 3;
const firstCard = cards[0] as HTMLElement;
let cardWidth = firstCard.offsetWidth + 24; // Ширина + gap
let cardWidth = firstCard.offsetWidth + 24;
// 1. Устанавливаем начальную позицию в центр (на реальный первый элемент)
const initialScroll = cardWidth * totalOriginal;
container.scrollLeft = initialScroll;
@ -223,19 +207,16 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
container.scrollLeft -= cardWidth;
};
// 2. Логика "Бесконечности" (Сквозной скроллинг)
container.addEventListener('scroll', () => {
const scrollPos = container.scrollLeft;
const maxScroll = container.scrollWidth - container.clientWidth;
// Если дошли почти до конца (правого края клонов), прыгаем в центр без анимации
if (scrollPos >= maxScroll - 5) {
container.style.scrollBehavior = 'auto';
container.scrollLeft = initialScroll;
container.style.scrollBehavior = 'smooth';
}
// Если дошли до самого начала (левого края клонов), прыгаем в центр
if (scrollPos <= 5) {
container.style.scrollBehavior = 'auto';
container.scrollLeft = initialScroll;
@ -246,19 +227,19 @@ const displayReviews = [...reviews, ...reviews, ...reviews];
nextBtn.addEventListener('click', handleNext);
prevBtn.addEventListener('click', handlePrev);
// Пересчет ширины при ресайзе
window.addEventListener('resize', () => {
const firstCard = cards[0] as HTMLElement;
cardWidth = firstCard.offsetWidth + 24;
if (firstCard) {
cardWidth = firstCard.offsetWidth + 24;
}
});
};
// Запуск
setupSlider();
setupAnimations();
// Для поддержки View Transitions в Astro
document.addEventListener('astro:after-swap', () => {
setupSlider();
setupAnimations();
});
</script>
</script>

View file

@ -0,0 +1,207 @@
---
export interface Props {
rating?: number;
interactive?: boolean;
size?: 'sm' | 'md' | 'lg';
onRate?: (rating: number) => void;
}
const { rating = 0, interactive = false, size = 'md' } = Astro.props;
const sizeClasses = {
sm: 'w-4 h-4',
md: 'w-5 h-5',
lg: 'w-7 h-7'
};
const starSize = sizeClasses[size];
const uniqueId = `rating-${Math.random().toString(36).substring(2, 9)}`;
---
<div class={`rating-stars ${interactive ? 'interactive' : ''}`} data-rating={rating} data-unique={uniqueId}>
{[1, 2, 3, 4, 5].map((star) => (
<button
type="button"
class={`star ${star <= rating ? 'filled' : ''} ${starSize}`}
data-value={star}
aria-label={`Оценка ${star} из 5`}
disabled={!interactive}
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill={star <= rating ? 'currentColor' : 'none'} stroke="currentColor">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
</svg>
</button>
))}
</div>
<style>
.rating-stars {
display: inline-flex;
gap: 0.25rem;
align-items: center;
}
.star {
background: none;
border: none;
padding: 0;
cursor: default;
color: #d1d5db;
display: inline-flex;
align-items: center;
justify-content: center;
transition: color 0.15s ease, transform 0.15s ease;
}
.star.filled {
color: #fbbf24;
}
.star.interactive {
cursor: pointer;
}
.star.interactive:hover {
transform: scale(1.15);
}
.star.interactive:active {
transform: scale(0.95);
}
/* Hover эффект для интерактивных звёзд */
.rating-stars.interactive:hover .star.interactive {
color: #fbbf24;
}
.rating-stars.interactive .star.interactive:hover ~ .star {
color: #d1d5db;
}
</style>
<script>
// Клиентский скрипт для интерактивного голосования
document.addEventListener('DOMContentLoaded', () => {
const containers = document.querySelectorAll('.rating-stars.interactive');
containers.forEach(container => {
const stars = container.querySelectorAll('.star.interactive');
let currentRating = parseInt(container.getAttribute('data-rating') || '0');
stars.forEach(star => {
star.addEventListener('click', () => {
const value = parseInt(star.getAttribute('data-value') || '0');
currentRating = value;
container.setAttribute('data-rating', value.toString());
// Обновляем классы звёзд
stars.forEach((s, index) => {
if (index < value) {
s.classList.add('filled');
} else {
s.classList.remove('filled');
}
});
// Диспатчим кастомное событие
window.dispatchEvent(
new CustomEvent('review-rated', {
detail: {
rating: value,
uniqueId: container.getAttribute('data-unique')
}
})
);
});
// Hover эффект
star.addEventListener('mouseenter', () => {
const value = parseInt(star.getAttribute('data-value') || '0');
stars.forEach((s, index) => {
const el = s as HTMLElement;
if (index < value) {
el.style.color = '#fbbf24';
} else {
el.style.color = '#d1d5db';
}
});
});
});
// Сброс при уходе мыши
container.addEventListener('mouseleave', () => {
stars.forEach((s, index) => {
const el = s as HTMLElement;
if (index < currentRating) {
el.style.color = '#fbbf24';
} else {
el.style.color = '#d1d5db';
}
});
});
});
});
// Для Astro View Transitions
document.addEventListener('astro:page-load', () => {
const containers = document.querySelectorAll('.rating-stars.interactive');
containers.forEach(container => {
const stars = container.querySelectorAll('.star.interactive');
let currentRating = parseInt(container.getAttribute('data-rating') || '0');
stars.forEach(star => {
star.replaceWith(star.cloneNode(true));
});
const newStars = container.querySelectorAll('.star.interactive');
newStars.forEach(star => {
star.addEventListener('click', () => {
const value = parseInt(star.getAttribute('data-value') || '0');
currentRating = value;
container.setAttribute('data-rating', value.toString());
newStars.forEach((s, index) => {
if (index < value) {
s.classList.add('filled');
} else {
s.classList.remove('filled');
}
});
window.dispatchEvent(
new CustomEvent('review-rated', {
detail: {
rating: value,
uniqueId: container.getAttribute('data-unique')
}
})
);
});
star.addEventListener('mouseenter', () => {
const value = parseInt(star.getAttribute('data-value') || '0');
newStars.forEach((s, index) => {
const el = s as HTMLElement;
if (index < value) {
el.style.color = '#fbbf24';
} else {
el.style.color = '#d1d5db';
}
});
});
});
container.addEventListener('mouseleave', () => {
newStars.forEach((s, index) => {
const el = s as HTMLElement;
if (index < currentRating) {
el.style.color = '#fbbf24';
} else {
el.style.color = '#d1d5db';
}
});
});
});
});
</script>

View file

@ -0,0 +1,266 @@
---
import RatingStars from './RatingStars.astro';
export interface Props {
name: string;
car: string;
text: string;
rating: number;
initial: string;
color: string;
date: string;
votesCount?: number;
isHelpful?: boolean;
}
const {
name,
car,
text,
rating,
initial,
color,
date,
votesCount = 0,
isHelpful = false
} = Astro.props;
// Форматируем дату
const formatDate = (dateStr: string) => {
const date = new Date(dateStr);
return date.toLocaleDateString('ru-RU', {
day: 'numeric',
month: 'long',
year: 'numeric'
});
};
---
<article class="review-card animate-on-scroll" data-animation="fade-up">
<!-- Шапка карточки -->
<div class="review-header">
<div class="author-info">
<div class={`avatar ${color}`}>
<span>{initial}</span>
</div>
<div class="author-details">
<h3 class="author-name">{name}</h3>
<p class="author-car">{car}</p>
</div>
</div>
<time class="review-date">{formatDate(date)}</time>
</div>
<!-- Рейтинг отзыва -->
<div class="review-rating">
<RatingStars rating={rating} size="md" />
</div>
<!-- Текст отзыва -->
<div class="review-text">
<p>{text}</p>
</div>
<!-- Блок голосования -->
<div class="voting-section">
<p class="voting-question">Полезен ли этот отзыв?</p>
<div class="voting-stars">
<RatingStars rating={0} size="lg" interactive />
</div>
<div class="voting-stats">
<span class="votes-count">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 20 20" fill="currentColor">
<path d="M2 10.5a1.5 1.5 0 113 0v6a1.5 1.5 0 01-3 0v-6zM6 10.333v5.43a2 2 0 001.106 1.79l.05.025A4 4 0 008.943 18h5.416a2 2 0 001.962-1.608l1.2-6A2 2 0 0015.56 8H12V4a2 2 0 00-2-2 1 1 0 00-1 1v.667a4 4 0 01-.8 2.4L6.8 7.933a4 4 0 00-.8 2.4z" />
</svg>
{votesCount}
</span>
{isHelpful && (
<span class="helpful-badge">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
</svg>
Полезно
</span>
)}
</div>
</div>
</article>
<style>
.review-card {
background: #ffffff;
border-radius: 1rem;
padding: 2rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
border: 1px solid #e2e8f0;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.review-card:hover {
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
border-color: #d4af37;
transform: translateY(-4px);
}
.review-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
}
.author-info {
display: flex;
align-items: center;
gap: 1rem;
}
.avatar {
width: 3.5rem;
height: 3.5rem;
border-radius: 0.75rem;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 1.25rem;
flex-shrink: 0;
}
.author-details {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.author-name {
color: #1e293b;
font-weight: 700;
font-size: 1.125rem;
margin: 0;
}
.author-car {
color: #64748b;
font-size: 0.875rem;
margin: 0;
}
.review-date {
color: #94a3b8;
font-size: 0.875rem;
white-space: nowrap;
}
.review-rating {
display: flex;
align-items: center;
}
.review-text {
color: #334155;
line-height: 1.7;
font-size: 0.95rem;
}
.review-text p {
margin: 0;
}
.voting-section {
margin-top: auto;
padding-top: 1.5rem;
border-top: 1px solid #e2e8f0;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.voting-question {
color: #475569;
font-size: 0.875rem;
font-weight: 600;
margin: 0;
}
.voting-stars {
display: flex;
align-items: center;
}
.voting-stats {
display: flex;
align-items: center;
gap: 1rem;
}
.votes-count {
display: inline-flex;
align-items: center;
gap: 0.375rem;
color: #64748b;
font-size: 0.875rem;
font-weight: 500;
}
.icon {
width: 1.125rem;
height: 1.125rem;
}
.helpful-badge {
display: inline-flex;
align-items: center;
gap: 0.375rem;
color: #059669;
font-size: 0.875rem;
font-weight: 600;
background: rgba(5, 150, 105, 0.1);
padding: 0.375rem 0.75rem;
border-radius: 0.5rem;
}
/* Анимации */
.animate-on-scroll {
opacity: 0;
will-change: opacity, transform;
}
[data-animation="fade-up"] {
transform: translateY(30px);
transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.animate-on-scroll.is-visible {
opacity: 1;
transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
.animate-on-scroll {
opacity: 1;
transform: none;
transition: none;
}
}
@media (max-width: 640px) {
.review-card {
padding: 1.5rem;
}
.review-header {
flex-direction: column;
gap: 0.75rem;
}
.author-info {
flex-direction: column;
align-items: flex-start;
}
}
</style>

View file

@ -0,0 +1,135 @@
---
export interface Props {
name: string;
car: string;
text: string;
rating: number;
initial: string;
color: string;
}
const { name, car, text, rating, initial, color } = Astro.props;
---
<div class="slider-review-card">
<div class="review-content">
<!-- Звёзды рейтинга -->
<div class="rating-stars">
{[1, 2, 3, 4, 5].map((star) => (
<svg
class={`star-icon ${star <= rating ? 'filled' : 'empty'}`}
viewBox="0 0 20 20"
>
<path
d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
fill={star <= rating ? 'currentColor' : 'none'}
/>
</svg>
))}
</div>
<!-- Текст отзыва -->
<p class="review-text">"{text}"</p>
</div>
<!-- Автор -->
<div class="review-author">
<div class={`author-avatar ${color}`}>
<span>{initial}</span>
</div>
<div class="author-info">
<h4 class="author-name">{name}</h4>
<p class="author-car">{car}</p>
</div>
</div>
</div>
<style>
.slider-review-card {
display: flex;
flex-direction: column;
justify-content: space-between;
min-height: 200px;
}
.review-content {
margin-bottom: 1.5rem;
}
.rating-stars {
display: flex;
gap: 0.25rem;
margin-bottom: 1.25rem;
}
.star-icon {
width: 1.25rem;
height: 1.25rem;
transition: color 0.2s ease;
}
.star-icon.filled {
color: #fbbf24;
}
.star-icon.empty {
color: #d1d5db;
}
.review-text {
color: #475569;
font-size: 0.95rem;
line-height: 1.7;
font-style: italic;
margin: 0;
}
.review-author {
display: flex;
align-items: center;
gap: 1rem;
}
.author-avatar {
width: 3rem;
height: 3rem;
border-radius: 0.75rem;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 1.125rem;
flex-shrink: 0;
}
.author-info {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.author-name {
color: #1e293b;
font-weight: 700;
font-size: 1rem;
margin: 0;
line-height: 1.2;
}
.author-car {
color: #94a3b8;
font-size: 0.875rem;
margin: 0;
}
@media (max-width: 768px) {
.slider-review-card {
padding: 1.5rem;
min-height: 260px;
}
.review-text {
font-size: 0.9rem;
}
}
</style>

View file

@ -0,0 +1,241 @@
---
export interface Props {
averageRating: number;
totalVotes: number;
totalReviews: number;
ratingDistribution: {
5: number;
4: number;
3: number;
2: number;
1: number;
};
}
const { averageRating, totalVotes, totalReviews, ratingDistribution } = Astro.props;
// Расчёт процентов для каждого рейтинга
const getPercentage = (count: number) => {
if (totalVotes === 0) return 0;
return Math.round((count / totalVotes) * 100);
};
---
<section class="voting-summary animate-on-scroll" data-animation="fade-up">
<div class="summary-container">
<h2 class="summary-title">Общая статистика отзывов</h2>
<div class="summary-grid">
<!-- Левая колонка - Общий рейтинг -->
<div class="overall-rating">
<div class="rating-big">
<span class="rating-number">{averageRating.toFixed(1)}</span>
<div class="rating-stars-big">
{[1, 2, 3, 4, 5].map((star) => (
<svg
xmlns="http://www.w3.org/2000/svg"
class={`star-icon ${star <= Math.round(averageRating) ? 'filled' : ''}`}
viewBox="0 0 24 24"
fill={star <= Math.round(averageRating) ? 'currentColor' : 'none'}
stroke="currentColor"
>
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
</svg>
))}
</div>
</div>
<p class="total-votes-text">
На основе <strong>{totalVotes}</strong> голосов
</p>
<p class="total-reviews-text">
<strong>{totalReviews}</strong> отзывов оставлено
</p>
</div>
<!-- Правая колонка - Распределение оценок -->
<div class="distribution">
{[5, 4, 3, 2, 1].map((rating) => (
<div class="distribution-row">
<span class="rating-label">{rating} ★</span>
<div class="progress-bar">
<div
class="progress-fill"
style={`width: ${getPercentage(ratingDistribution[rating as keyof typeof ratingDistribution])}%`}
></div>
</div>
<span class="rating-count">{ratingDistribution[rating as keyof typeof ratingDistribution]}</span>
</div>
))}
</div>
</div>
</div>
</section>
<style>
.voting-summary {
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
border-radius: 1.5rem;
padding: 3rem;
margin: 3rem 0;
border: 2px solid #d4af37;
}
.summary-container {
max-width: 1200px;
margin: 0 auto;
}
.summary-title {
color: #1e293b;
font-size: clamp(1.5rem, 3vw, 2rem);
font-weight: 800;
text-align: center;
margin: 0 0 2.5rem 0;
letter-spacing: -0.02em;
}
.summary-grid {
display: grid;
grid-template-columns: 1fr 1.5fr;
gap: 3rem;
align-items: center;
}
.overall-rating {
text-align: center;
padding: 2rem;
background: rgba(255, 255, 255, 0.7);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.rating-big {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
.rating-number {
font-size: 4rem;
font-weight: 900;
color: #d4af37;
line-height: 1;
}
.rating-stars-big {
display: flex;
gap: 0.25rem;
color: #d1d5db;
}
.star-icon {
width: 2rem;
height: 2rem;
transition: color 0.2s ease;
}
.star-icon.filled {
color: #fbbf24;
}
.total-votes-text,
.total-reviews-text {
color: #475569;
font-size: 1rem;
margin: 0.75rem 0 0 0;
}
.total-votes-text strong,
.total-reviews-text strong {
color: #1e293b;
font-weight: 700;
}
.distribution {
display: flex;
flex-direction: column;
gap: 1rem;
}
.distribution-row {
display: flex;
align-items: center;
gap: 1rem;
}
.rating-label {
min-width: 3rem;
color: #475569;
font-weight: 600;
font-size: 0.95rem;
}
.progress-bar {
flex: 1;
height: 0.75rem;
background: rgba(255, 255, 255, 0.5);
border-radius: 1rem;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #d4af37 0%, #fbbf24 100%);
border-radius: 1rem;
transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.rating-count {
min-width: 2.5rem;
text-align: right;
color: #64748b;
font-weight: 600;
font-size: 0.875rem;
}
/* Анимации */
.animate-on-scroll {
opacity: 0;
will-change: opacity, transform;
}
[data-animation="fade-up"] {
transform: translateY(30px);
transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.animate-on-scroll.is-visible {
opacity: 1;
transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
.animate-on-scroll {
opacity: 1;
transform: none;
transition: none;
}
}
@media (max-width: 768px) {
.voting-summary {
padding: 2rem;
}
.summary-grid {
grid-template-columns: 1fr;
gap: 2rem;
}
.rating-number {
font-size: 3rem;
}
.star-icon {
width: 1.5rem;
height: 1.5rem;
}
}
</style>

View file

@ -11,7 +11,7 @@ interface ServiceItem {
title: string;
description: string;
price: string;
icon: string; // Now stores emoji (e.g., "🚗", "📄")
icon: string;
href: string;
features: string[];
}

View file

@ -11,7 +11,7 @@ export const COMPANY = {
fullName: 'Центр защиты прав водителей "Автоюрист 086"',
phone: '+7 (922) 253-83-75',
email: 'redibedi2019@gmail.com',
address: 'г. Сургут, ул. Примерная, д. 1',
address: 'г. Сургут, пр. Комсомольский, д. 19',
workHours: 'Пн-Пт: 9:00 - 18:00',
} as const;

View file

@ -0,0 +1,127 @@
export interface Review {
name: string;
car: string;
text: string;
rating: number;
initial: string;
color: string;
date: string;
votesCount: number;
isHelpful: boolean;
}
export const reviewsData: Review[] = [
{
name: "Алексей М.",
car: "Toyota Camry",
text: "Помогли вернуть права после того, как инспектор незаконно составил протокол за встречку. Юрист нашел кучу ошибок в схеме ДТП. Огромное спасибо!",
rating: 5,
initial: "А",
color: "bg-blue-100 text-blue-600",
date: "2024-03-15",
votesCount: 24,
isHelpful: true
},
{
name: "Екатерина П.",
car: "Hyundai Solaris",
text: "Страховая выплатила копейки по ОСАГО. Обратилась сюда, сделали независимую экспертизу и через суд взыскали еще 120 тысяч. Профессионалы!",
rating: 5,
initial: "Е",
color: "bg-teal-100 text-teal-600",
date: "2024-03-10",
votesCount: 18,
isHelpful: true
},
{
name: "Игорь С.",
car: "Lexus RX",
text: "Грамотно разобрали сложное ДТП на перекрестке. Доказали, что я не виноват, хотя ГИБДД изначально решило иначе. Лучшие в Сургуте.",
rating: 5,
initial: "И",
color: "bg-orange-100 text-orange-600",
date: "2024-03-05",
votesCount: 31,
isHelpful: true
},
{
name: "Марина К.",
car: "Kia Rio",
text: "Обратилась по вопросу возврата прав после лишения. Всё сделали быстро и профессионально. Через 2 месяца права уже были у меня. Рекомендую!",
rating: 4,
initial: "М",
color: "bg-pink-100 text-pink-600",
date: "2024-02-28",
votesCount: 15,
isHelpful: true
},
{
name: "Дмитрий В.",
car: "Volkswagen Tiguan",
text: "Были проблемы со страховой после ДТП. Юристы помогли составить претензию, потом представляли интересы в суде. Выиграли дело полностью.",
rating: 5,
initial: "Д",
color: "bg-purple-100 text-purple-600",
date: "2024-02-20",
votesCount: 22,
isHelpful: true
},
{
name: "Ольга Н.",
car: "Mazda CX-5",
text: "Купила б/у авто с проблемами, которые не были указаны при продаже. Юристы помогли вернуть деньги через суд. Очень благодарна за помощь!",
rating: 5,
initial: "О",
color: "bg-indigo-100 text-indigo-600",
date: "2024-02-15",
votesCount: 27,
isHelpful: true
},
{
name: "Сергей Т.",
car: "Nissan Qashqai",
text: "Спор со страховой длился полгода. Сам не мог ничего добиться. Обратился сюда - ребята за 2 месяца решили вопрос в мою пользу. Супер!",
rating: 4,
initial: "С",
color: "bg-green-100 text-green-600",
date: "2024-02-08",
votesCount: 19,
isHelpful: true
},
{
name: "Анна Р.",
car: "Skoda Octavia",
text: "Помогли оспорить штраф с камеры, который пришел ошибочно. Юрист быстро разобрался в ситуации и подготовил все документы. Спасибо!",
rating: 5,
initial: "А",
color: "bg-yellow-100 text-yellow-600",
date: "2024-02-01",
votesCount: 12,
isHelpful: false
},
{
name: "Виктор Л.",
car: "Honda CR-V",
text: "Обратился по вопросу компенсации после ДТП. Страховая занижала выплату в 3 раза. Сделали экспертизу и через суд добились справедливой суммы.",
rating: 5,
initial: "В",
color: "bg-red-100 text-red-600",
date: "2024-01-25",
votesCount: 35,
isHelpful: true
}
];
// Агрегированные данные для голосования
export const votingSummary = {
averageRating: 4.8,
totalVotes: 203,
totalReviews: reviewsData.length,
ratingDistribution: {
5: 7,
4: 2,
3: 0,
2: 0,
1: 0
}
};

View file

@ -1,6 +1,9 @@
---
import Layout from '@layouts/Layout.astro';
import { SITE_URL } from '@constants';
import { SITE_URL, COMPANY } from '@constants';
// Логика авторизации (пока статичная переменная)
const isAuthorized = false; // Измените на true, чтобы увидеть форму
---
<Layout
@ -8,6 +11,486 @@ import { SITE_URL } from '@constants';
description="Свяжитесь с нами для консультации по вопросам автоспоров и юридической помощи автовладельцам."
canonicalLink={`${SITE_URL}/contacts`}
>
<h1>Контакты</h1>
<!-- Hero-секция -->
<section class="contacts-hero">
<div class="site-container">
<div class="hero-content">
<div class="badge animate-on-scroll" data-animation="fade-up">
<span class="status-dot"></span>
БЕСПЛАТНАЯ КОНСУЛЬТАЦИЯ
</div>
<h1 class="title animate-on-scroll" data-animation="fade-up" data-delay="100">
Свяжитесь <span class="text-gold">с нами</span>
</h1>
<p class="description animate-on-scroll" data-animation="fade-up" data-delay="200">
Мы всегда на связи и готовы помочь вам в решении автоспоров. Оставьте заявку или позвоните — первая консультация бесплатно.
</p>
</div>
</div>
</section>
<!-- Карточки контактов -->
<section class="contact-cards">
<div class="site-container">
<div class="cards-grid">
<!-- Телефон -->
<div class="contact-card animate-on-scroll" data-animation="fade-up" data-delay="100">
<div class="card-icon phone">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path>
</svg>
</div>
<h3 class="card-title">Телефон</h3>
<a href={`tel:${COMPANY.phone.replace(/\s/g, '')}`} class="card-link">
{COMPANY.phone}
</a>
<p class="card-description">Звоните в рабочее время</p>
</div>
<!-- Email -->
<div class="contact-card animate-on-scroll" data-animation="fade-up" data-delay="200">
<div class="card-icon email">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect width="20" height="16" x="2" y="4" rx="2"></rect>
<path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"></path>
</svg>
</div>
<h3 class="card-title">Email</h3>
<a href={`mailto:${COMPANY.email}`} class="card-link">
{COMPANY.email}
</a>
<p class="card-description">Ответим в течение 24 часов</p>
</div>
<!-- Адрес и часы -->
<div class="contact-card animate-on-scroll" data-animation="fade-up" data-delay="300">
<div class="card-icon location">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>
</div>
<h3 class="card-title">Адрес</h3>
<p class="card-text">{COMPANY.address}</p>
<div class="work-hours">
<svg xmlns="http://www.w3.org/2000/svg" class="hours-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
<span>{COMPANY.workHours}</span>
</div>
</div>
</div>
</div>
</section>
<!-- Форма обратной связи -->
<section class="contact-form-section">
<div class="site-container">
<div class="form-header">
<h2 class="section-title animate-on-scroll" data-animation="fade-up">
Напишите <span class="text-gold">нам</span>
</h2>
<p class="section-description animate-on-scroll" data-animation="fade-up" data-delay="100">
Опишите вашу ситуацию — мы ответим в ближайшее время
</p>
</div>
{isAuthorized ? (
<form class="contact-form animate-on-scroll" data-animation="fade-up" data-delay="200" action="#" method="POST" id="contact-form">
<div class="form-row">
<div class="form-group">
<label for="contact-name" class="form-label">Ваше имя *</label>
<input
type="text"
id="contact-name"
name="name"
class="form-input"
placeholder="Иван Иванов"
required
/>
</div>
<div class="form-group">
<label for="contact-phone" class="form-label">Телефон *</label>
<input
type="tel"
id="contact-phone"
name="phone"
class="form-input"
placeholder="+7 (___) ___-__-__"
required
/>
</div>
</div>
<div class="form-group">
<label for="contact-email" class="form-label">Email</label>
<input
type="email"
id="contact-email"
name="email"
class="form-input"
placeholder="example@mail.ru"
/>
</div>
<div class="form-group">
<label for="contact-message" class="form-label">Сообщение *</label>
<textarea
id="contact-message"
name="message"
class="form-textarea"
placeholder="Опишите вашу ситуацию..."
rows="5"
required
></textarea>
</div>
<button type="submit" class="submit-btn">
Отправить сообщение
</button>
<p class="form-privacy">
Нажимая кнопку, вы соглашаетесь с
<a href="/privacy" class="privacy-link">политикой конфиденциальности</a>
</p>
</form>
) : (
<div class="auth-lock-card animate-on-scroll" data-animation="fade-up" data-delay="200">
<div class="lock-icon-container">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lock-icon">
<rect width="18" height="11" x="3" y="11" rx="2" ry="2"></rect>
<path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
</svg>
</div>
<h3 class="lock-title">Форма доступна только клиентам</h3>
<p class="lock-text">Чтобы отправить сообщение напрямую юристу, пожалуйста, авторизуйтесь в личном кабинете.</p>
<a href="/login" class="auth-button">Войти в кабинет</a>
</div>
)}
</div>
</section>
<!-- CTA-блок -->
<section class="contacts-cta">
<div class="site-container">
<div class="cta-content">
<h2 class="cta-title animate-on-scroll" data-animation="fade-up">
Нужна срочная помощь?
</h2>
<p class="cta-text animate-on-scroll" data-animation="fade-up" data-delay="100">
Запишитесь на бесплатную консультацию прямо сейчас — мы перезвоним в течение 15 минут
</p>
<button class="cta-button animate-on-scroll" data-animation="fade-up" data-delay="200" id="consultation-btn" data-modal-target="consultation-modal">
Записаться на консультацию
</button>
</div>
</div>
</section>
</Layout>
<style>
/* ===== HERO ===== */
.contacts-hero {
background: linear-gradient(135deg, #0a2540 0%, #1e3a5f 100%);
padding: 8rem 0 4rem;
position: relative;
overflow: hidden;
}
.contacts-hero::before {
content: '';
position: absolute;
top: -50%;
right: -10%;
width: 600px;
height: 600px;
background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
border-radius: 50%;
}
.hero-content {
position: relative;
z-index: 1;
text-align: center;
max-width: 700px;
margin: 0 auto;
}
.badge {
display: inline-flex;
align-items: center;
gap: 0.6rem;
background-color: rgba(234, 194, 110, 0.15);
border: 1px solid rgba(234, 194, 110, 0.3);
color: #eac26e;
padding: 0.5rem 1rem;
border-radius: 6px;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 1.5px;
margin-bottom: 2rem;
}
.status-dot {
width: 10px;
height: 10px;
background: #22c55e;
border-radius: 50%;
animation: pulse 2s ease-in-out infinite;
box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
flex-shrink: 0;
}
@keyframes pulse {
0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.title {
font-size: clamp(2.5rem, 5vw, 4rem);
font-weight: 800;
color: #ffffff;
margin: 0 0 1.5rem;
line-height: 1.15;
letter-spacing: -0.02em;
}
.text-gold { color: #eac26e; }
.description {
color: rgba(255, 255, 255, 0.8);
font-size: 1.15rem;
line-height: 1.6;
margin: 0;
}
/* ===== CONTACT CARDS ===== */
.contact-cards {
padding: 5rem 0;
background: #f8fafc;
}
.cards-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 2rem;
}
.contact-card {
background: #ffffff;
border-radius: 1rem;
padding: 2.5rem 2rem;
text-align: center;
border: 2px solid transparent;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.contact-card:hover {
border-color: #d4af37;
box-shadow: 0 12px 30px rgba(212, 175, 55, 0.12);
transform: translateY(-6px);
}
.card-icon {
width: 4rem;
height: 4rem;
border-radius: 1rem;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 1.5rem;
}
.card-icon.phone { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #2563eb; }
.card-icon.email { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #d4af37; }
.card-icon.location { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); color: #16a34a; }
.card-icon svg { width: 1.75rem; height: 1.75rem; }
.card-title { color: #1e293b; font-size: 1.25rem; font-weight: 700; margin: 0 0 0.75rem; }
.card-link { color: #d4af37; font-size: 1.1rem; font-weight: 600; text-decoration: none; transition: color 0.2s ease; display: block; margin-bottom: 0.5rem; }
.card-link:hover { color: #b8942e; text-decoration: underline; }
.card-description { color: #94a3b8; font-size: 0.875rem; margin: 0; }
.card-text { color: #475569; font-size: 1rem; margin: 0 0 0.75rem; line-height: 1.5; }
.work-hours {
display: inline-flex;
align-items: center;
gap: 0.5rem;
color: #64748b;
font-size: 0.875rem;
font-weight: 500;
background: #f1f5f9;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
}
.hours-icon { width: 1rem; height: 1rem; }
/* ===== FORM SECTION & AUTH LOCK ===== */
.contact-form-section {
padding: 5rem 0;
background: #ffffff;
}
.form-header { text-align: center; margin-bottom: 3rem; }
.section-title { font-size: clamp(2rem, 4vw, 2.5rem); font-weight: 800; color: #1e293b; margin: 0 0 1rem; }
.section-description { color: #64748b; font-size: 1.1rem; margin: 0; }
/* Auth Lock Card */
.auth-lock-card {
max-width: 600px;
margin: 0 auto;
background: #f8fafc;
border: 2px dashed #e2e8f0;
border-radius: 1.5rem;
padding: 4rem 2rem;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
.lock-icon-container {
width: 5rem;
height: 5rem;
background: #ffffff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: #94a3b8;
margin-bottom: 1.5rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}
.lock-icon { width: 2rem; height: 2rem; }
.lock-title { color: #1e293b; font-size: 1.5rem; font-weight: 700; margin: 0 0 1rem; }
.lock-text { color: #64748b; line-height: 1.6; margin: 0 0 2rem; max-width: 400px; }
.auth-button {
background: #1e293b;
color: #ffffff;
padding: 0.875rem 2rem;
border-radius: 0.75rem;
font-weight: 700;
text-decoration: none;
transition: all 0.3s ease;
}
.auth-button:hover { background: #0f172a; transform: translateY(-2px); }
/* Contact Form Styles */
.contact-form {
max-width: 700px;
margin: 0 auto;
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-label { font-size: 0.9rem; font-weight: 600; color: #1e293b; }
.form-input, .form-textarea {
padding: 0.875rem 1rem;
border: 2px solid #e2e8f0;
border-radius: 0.75rem;
font-size: 1rem;
font-family: inherit;
transition: all 0.2s ease;
outline: none;
background: #f8fafc;
}
.form-input:focus, .form-textarea:focus {
border-color: #d4af37;
box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
background: #ffffff;
}
.form-textarea { resize: vertical; min-height: 140px; }
.submit-btn {
background: linear-gradient(135deg, #d4af37 0%, #eac26e 100%);
color: #1e293b;
border: none;
padding: 1rem 2rem;
border-radius: 0.75rem;
font-size: 1.1rem;
font-weight: 700;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}
.submit-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4); }
.form-privacy { font-size: 0.8rem; color: #94a3b8; text-align: center; }
.privacy-link { color: #d4af37; text-decoration: underline; }
/* ===== CTA & MAP ===== */
.contacts-cta { padding: 5rem 0; background: linear-gradient(135deg, #0a2540 0%, #1e3a5f 100%); position: relative; overflow: hidden; }
.cta-content { position: relative; z-index: 1; text-align: center; max-width: 600px; margin: 0 auto; }
.cta-title { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; color: #ffffff; margin: 0 0 1rem; }
.cta-text { color: rgba(255, 255, 255, 0.75); font-size: 1.1rem; margin: 0 0 2rem; }
.cta-button { background: linear-gradient(135deg, #d4af37 0%, #eac26e 100%); color: #1e293b; border: none; padding: 1rem 2.5rem; border-radius: 0.75rem; font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.3s ease; }
.cta-button:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4); }
/* ===== ANIMATIONS ===== */
.animate-on-scroll { opacity: 0; will-change: opacity, transform; }
[data-animation="fade-up"] { transform: translateY(30px); transition: opacity 0.7s ease, transform 0.7s ease; }
.animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }
/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
.cards-grid { grid-template-columns: 1fr; }
.form-row { grid-template-columns: 1fr; }
.auth-lock-card { padding: 3rem 1.5rem; }
}
</style>
<script>
const setupAnimations = () => {
const observerOptions = { threshold: 0.1 };
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));
};
const setupForm = () => {
// Проверяем наличие формы, так как она может быть скрыта условием isAuthorized
const form = document.getElementById('contact-form') as HTMLFormElement;
if (form) {
form.addEventListener('submit', (e) => {
e.preventDefault();
const formData = new FormData(form);
console.log('Отправка формы:', Object.fromEntries(formData));
alert('Спасибо! Ваше сообщение отправлено.');
form.reset();
});
}
};
// Инициализация
setupAnimations();
setupForm();
// Для поддержки Astro transitions
document.addEventListener('astro:after-swap', () => {
setupAnimations();
setupForm();
});
</script>

View file

@ -1,13 +1,230 @@
---
import Layout from '@layouts/Layout.astro';
import { SITE_URL } from '@constants';
import ReviewCard from '@components/reviews/ReviewCard.astro';
import VotingSummary from '@components/reviews/VotingSummary.astro';
import { reviewsData, votingSummary } from '@data/reviewsData';
---
<Layout
title="Отзывы клиентов — автоюрист в Сургуте"
description="Отзывы реальных клиентов о нашей юридической помощи по автоспорам в Сургуте."
description="Отзывы реальных клиентов о нашей юридической помощи по автоспорам в Сургуте. Реальные истории и голосования."
canonicalLink={`${SITE_URL}/reviews`}
>
<h1>Отзывы</h1>
<section class="reviews-page">
<div class="site-container">
<!-- Заголовок страницы -->
<div class="page-header">
<span class="subtitle animate-on-scroll" data-animation="fade-up">Отзывы клиентов</span>
<h1 class="title animate-on-scroll" data-animation="fade-up" data-delay="100">
Реальные истории водителей из Сургута
</h1>
<p class="description animate-on-scroll" data-animation="fade-up" data-delay="200">
Узнайте, как мы помогли нашим клиентам решить их проблемы с автоспорами
</p>
</div>
<!-- Блок статистики голосования -->
<VotingSummary
averageRating={votingSummary.averageRating}
totalVotes={votingSummary.totalVotes}
totalReviews={votingSummary.totalReviews}
ratingDistribution={votingSummary.ratingDistribution}
/>
<!-- Сетка отзывов -->
<div class="reviews-grid">
{reviewsData.map((review, index) => (
<ReviewCard
name={review.name}
car={review.car}
text={review.text}
rating={review.rating}
initial={review.initial}
color={review.color}
date={review.date}
votesCount={review.votesCount}
isHelpful={review.isHelpful}
/>
))}
</div>
<!-- CTA блок -->
<div class="cta-section animate-on-scroll" data-animation="fade-up" data-delay="300">
<h2 class="cta-title">Хотите оставить отзыв?</h2>
<p class="cta-text">
Поделитесь своим опытом работы с нами. Ваш отзыв поможет другим водителям принять правильное решение.
</p>
<a href="/contacts" class="cta-button">
Оставить отзыв
</a>
</div>
</div>
</section>
</Layout>
<style>
.reviews-page {
padding: 8rem 0 4rem 0;
background: #f8fafc;
}
.page-header {
text-align: center;
margin-bottom: 3rem;
}
.subtitle {
display: inline-block;
color: #d4af37;
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 3px;
margin-bottom: 1rem;
padding: 0.5rem 1rem;
background: rgba(212, 175, 55, 0.1);
border-radius: 6px;
}
.title {
color: #1e293b;
font-size: clamp(2rem, 4vw, 3rem);
font-weight: 800;
margin: 0 0 1rem 0;
line-height: 1.2;
letter-spacing: -0.02em;
}
.description {
color: #64748b;
font-size: 1.125rem;
max-width: 600px;
margin: 0 auto;
line-height: 1.6;
}
.reviews-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 2rem;
margin: 3rem 0;
}
/* CTA блок */
.cta-section {
margin-top: 4rem;
padding: 3rem;
background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
border-radius: 1.5rem;
text-align: center;
}
.cta-title {
color: #ffffff;
font-size: clamp(1.5rem, 3vw, 2rem);
font-weight: 800;
margin: 0 0 1rem 0;
letter-spacing: -0.02em;
}
.cta-text {
color: #cbd5e1;
font-size: 1.125rem;
max-width: 600px;
margin: 0 auto 2rem;
line-height: 1.6;
}
.cta-button {
display: inline-block;
padding: 1rem 2.5rem;
background: linear-gradient(135deg, #d4af37 0%, #fbbf24 100%);
color: #1e293b;
font-weight: 700;
font-size: 1.125rem;
text-decoration: none;
border-radius: 0.75rem;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}
.cta-button:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}
/* Анимации */
.animate-on-scroll {
opacity: 0;
will-change: opacity, transform;
}
[data-animation="fade-up"] {
transform: translateY(30px);
transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.animate-on-scroll.is-visible {
opacity: 1;
transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
.animate-on-scroll {
opacity: 1;
transform: none;
transition: none;
}
}
@media (max-width: 768px) {
.reviews-grid {
grid-template-columns: 1fr;
gap: 1.5rem;
}
.cta-section {
padding: 2rem;
}
}
</style>
<script>
// Intersection Observer для анимаций при скроллинге
const setupAnimations = () => {
const observerOptions = {
root: null,
rootMargin: '0px 0px -50px 0px',
threshold: 0.1
};
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);
});
};
// Запуск
setupAnimations();
// Для поддержки View Transitions в Astro
document.addEventListener('astro:after-swap', () => {
setupAnimations();
});
</script>

View file

@ -7,6 +7,7 @@
"paths": {
"@styles/*": ["src/styles/*"],
"@components/*": ["src/components/*"],
"@data/*": ["src/data/*"],
"@constants": ["src/constants.ts"],
"@constants/*": ["src/constants/*"],
"@layouts/*": ["src/layouts/*"],