2026-04-06 21:28:31 +05:00
|
|
|
|
---
|
|
|
|
|
|
import Layout from '@layouts/Layout.astro';
|
|
|
|
|
|
import { SITE_URL } from '@constants';
|
2026-04-08 20:15:49 +05:00
|
|
|
|
import PageHero from '@components/base/PageHero.astro';
|
2026-04-06 21:28:31 +05:00
|
|
|
|
import BlogCategories from '@components/blog/BlogCategories.astro';
|
|
|
|
|
|
import BlogCard from '@components/blog/BlogCard.astro';
|
2026-04-08 21:11:36 +05:00
|
|
|
|
import Pagination from '@components/base/Pagination.astro';
|
|
|
|
|
|
import CTA from '@components/base/CTA.astro';
|
2026-04-07 18:53:23 +05:00
|
|
|
|
import SearchModal from '@components/base/SearchModal.astro';
|
2026-04-09 22:22:55 +05:00
|
|
|
|
import { getCollection } from 'astro:content';
|
|
|
|
|
|
|
|
|
|
|
|
const posts = await getCollection('blog');
|
|
|
|
|
|
|
|
|
|
|
|
// Сортируем посты по дате (новые сверху)
|
|
|
|
|
|
const sortedPosts = posts.sort((a, b) => b.data.date.getTime() - a.data.date.getTime());
|
2026-04-07 22:53:04 +05:00
|
|
|
|
|
|
|
|
|
|
const POSTS_PER_PAGE = 6;
|
|
|
|
|
|
const currentPage = 1;
|
2026-04-09 22:22:55 +05:00
|
|
|
|
const totalPages = Math.ceil(sortedPosts.length / POSTS_PER_PAGE);
|
2026-04-07 22:53:04 +05:00
|
|
|
|
|
|
|
|
|
|
const startIndex = 0;
|
|
|
|
|
|
const endIndex = POSTS_PER_PAGE;
|
2026-04-09 22:22:55 +05:00
|
|
|
|
const paginatedPosts = sortedPosts.slice(startIndex, endIndex);
|
|
|
|
|
|
|
|
|
|
|
|
// Форматируем дату
|
|
|
|
|
|
const formatDate = (date: Date) => {
|
|
|
|
|
|
return date.toLocaleDateString('ru-RU', {
|
|
|
|
|
|
day: 'numeric',
|
|
|
|
|
|
month: 'long',
|
|
|
|
|
|
year: 'numeric'
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Категории
|
|
|
|
|
|
const categories = ['Все', ...new Set(posts.map((post: any) => post.data.category))];
|
2026-04-06 21:28:31 +05:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
<Layout
|
|
|
|
|
|
title="Блог — автоюрист в Сургуте"
|
|
|
|
|
|
description="Полезные статьи и советы по автоспорам, ДТП, ОСАГО, лишению прав и защите прав водителей."
|
|
|
|
|
|
canonicalLink={`${SITE_URL}/blog`}
|
2026-04-07 22:53:04 +05:00
|
|
|
|
breadcrumbs={[
|
|
|
|
|
|
{ label: "Главная", href: "/" },
|
|
|
|
|
|
{ label: "Блог" }
|
|
|
|
|
|
]}
|
2026-04-06 21:28:31 +05:00
|
|
|
|
>
|
2026-04-08 20:15:49 +05:00
|
|
|
|
<PageHero
|
|
|
|
|
|
badgeText="БЛОГ И СТАТЬИ"
|
|
|
|
|
|
titleWhite="Полезные статьи"
|
|
|
|
|
|
titleGold="для автовладельцев"
|
|
|
|
|
|
description="Разбираем сложные юридические вопросы простым языком. Советы юриста по автоспорам, ДТП, ОСАГО и защите прав водителей."
|
|
|
|
|
|
layout="with-image"
|
2026-04-08 22:54:23 +05:00
|
|
|
|
sideImage="/images/blog/blogImg.avif"
|
2026-04-08 20:15:49 +05:00
|
|
|
|
sideImageAlt="Автоюрист Сургут"
|
|
|
|
|
|
experienceBadge={{
|
|
|
|
|
|
number: "50+",
|
|
|
|
|
|
text: "ПОЛЕЗНЫХ СТАТЕЙ"
|
|
|
|
|
|
}}
|
2026-04-08 22:54:23 +05:00
|
|
|
|
bgImage="/images/blog/blogBg.avif"
|
2026-04-08 20:15:49 +05:00
|
|
|
|
/>
|
2026-04-07 20:53:26 +05:00
|
|
|
|
|
2026-04-07 22:53:04 +05:00
|
|
|
|
<BlogCategories categories={categories} activeCategory="Все" currentPage={currentPage} />
|
2026-04-06 21:28:31 +05:00
|
|
|
|
|
|
|
|
|
|
<!-- Сетка статей -->
|
|
|
|
|
|
<section class="blog-grid-section">
|
|
|
|
|
|
<div class="site-container">
|
2026-04-07 20:53:26 +05:00
|
|
|
|
<div class="blog-grid" id="blog-grid">
|
2026-04-09 22:22:55 +05:00
|
|
|
|
{paginatedPosts.map((post: any) => (
|
|
|
|
|
|
<article class="blog-card-wrapper" data-category={post.data.category}>
|
2026-04-07 20:53:26 +05:00
|
|
|
|
<BlogCard
|
2026-04-09 22:22:55 +05:00
|
|
|
|
title={post.data.title}
|
|
|
|
|
|
description={post.data.description}
|
|
|
|
|
|
category={post.data.category}
|
|
|
|
|
|
categoryColor={post.data.categoryColor}
|
|
|
|
|
|
date={formatDate(post.data.date)}
|
|
|
|
|
|
readTime={post.data.readTime}
|
|
|
|
|
|
imageUrl={post.data.imageUrl}
|
|
|
|
|
|
slug={`/blog/${post.id}`}
|
2026-04-07 20:53:26 +05:00
|
|
|
|
/>
|
|
|
|
|
|
</article>
|
2026-04-06 21:28:31 +05:00
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Пагинация -->
|
2026-04-08 21:11:36 +05:00
|
|
|
|
<Pagination
|
|
|
|
|
|
currentPage={currentPage}
|
|
|
|
|
|
totalPages={totalPages}
|
|
|
|
|
|
baseUrl="/blog"
|
|
|
|
|
|
/>
|
2026-04-06 21:28:31 +05:00
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- CTA-блок -->
|
2026-04-08 21:11:36 +05:00
|
|
|
|
<CTA
|
|
|
|
|
|
icon="consult"
|
|
|
|
|
|
title="Нужна консультация юриста?"
|
|
|
|
|
|
description="Не нашли ответ на свой вопрос? Запишитесь на бесплатную консультацию — мы поможем разобраться в вашей ситуации"
|
|
|
|
|
|
btnText="Записаться на консультацию"
|
|
|
|
|
|
/>
|
2026-04-06 21:28:31 +05:00
|
|
|
|
|
2026-04-07 20:53:26 +05:00
|
|
|
|
<SearchModal />
|
|
|
|
|
|
</Layout>
|
2026-04-07 18:53:23 +05:00
|
|
|
|
|
2026-04-06 21:28:31 +05:00
|
|
|
|
<style>
|
|
|
|
|
|
.blog-grid-section {
|
|
|
|
|
|
padding: 3rem 0 0;
|
|
|
|
|
|
background: #f8fafc;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.blog-grid {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: repeat(3, 1fr);
|
|
|
|
|
|
gap: 2rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-07 20:53:26 +05:00
|
|
|
|
.blog-card-wrapper {
|
|
|
|
|
|
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-06 21:28:31 +05:00
|
|
|
|
/* ===== RESPONSIVE ===== */
|
|
|
|
|
|
@media (max-width: 1024px) {
|
|
|
|
|
|
.blog-grid {
|
|
|
|
|
|
grid-template-columns: repeat(2, 1fr);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
|
|
.blog-grid {
|
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
|
gap: 1.5rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.blog-cta {
|
|
|
|
|
|
padding: 3rem 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
2026-04-08 20:15:49 +05:00
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
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();
|
|
|
|
|
|
document.addEventListener('astro:after-swap', setupAnimations);
|
|
|
|
|
|
</script>
|