Создание страницы - Контакты
This commit is contained in:
parent
6828b990a9
commit
f84c24e91f
11 changed files with 1733 additions and 75 deletions
266
frontend/src/components/reviews/ReviewCard.astro
Normal file
266
frontend/src/components/reviews/ReviewCard.astro
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue