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

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[];
}