Новые правки в компоенты

This commit is contained in:
Web-serfer 2026-04-26 18:09:40 +05:00
parent 107b7f461f
commit a14c18542e
15 changed files with 417 additions and 233 deletions

View file

@ -37,14 +37,13 @@ while ((match = headingRegex.exec(body)) !== null) {
const text = match[2].trim();
tocItems.push({ level, id: `heading-${headingIndex++}`, text });
}
// Форматируем дату
console.log('[DEBUG] tocItems:', JSON.stringify(tocItems));
const formatDate = (date: string) => {
return new Date(date).toLocaleDateString('ru-RU', {
day: 'numeric',
month: 'long',
year: 'numeric'
});
const d = new Date(date);
const day = d.getDate().toString().padStart(2, '0');
const month = (d.getMonth() + 1).toString().padStart(2, '0');
const year = new Date().getFullYear().toString().slice(-2);
return `${day}/${month}/${year}`;
};
// Для related posts берем те же категории
@ -77,22 +76,24 @@ const heroImage = getPostImageUrl(post);
initialLikes={likes}
initialDislikes={dislikes}
>
<!-- Содержимое статьи -->
<div class="post-content" set:html={contentHtml} />
<!-- Содержимое статьи в article -->
<article class="article-content-wrapper" id="post-content">
<div class="post-content" set:html={contentHtml} />
</article>
<!-- Система комментариев -->
<div class="comments-wrapper">
<!-- Комментарии и похожие статьи - ВНЕ article -->
{/*
<div class="comments-wrapper">
<Comments postSlug={post.slug} client:load />
</div>
<RelatedPosts posts={filteredRelated} currentSlug={slug} />
*/}
<!-- Оглавление - пробуем без slot -->
<div slot="sidebar">
<ArticleTableOfContents items={tocItems} />
</div>
<!-- Похожие статьи -->
<RelatedPosts
posts={filteredRelated}
currentSlug={slug}
/>
<!-- Оглавление в сайдбаре -->
<ArticleTableOfContents items={tocItems} slot="sidebar" />
</ArticleLayout>
<style>
@ -100,7 +101,8 @@ const heroImage = getPostImageUrl(post);
.post-content {
padding: 0;
color: #334155;
line-height: 1.8;
line-height: 1.85;
font-family: 'Merriweather', Georgia, serif;
}
.post-content :global(h2) {
@ -109,6 +111,10 @@ const heroImage = getPostImageUrl(post);
font-weight: 700;
margin: 2rem 0 1rem;
letter-spacing: -0.02em;
font-family: 'Merriweather', Georgia, serif;
display: flex;
align-items: baseline;
gap: 0.6rem;
}
.post-content :global(h3) {
@ -116,6 +122,10 @@ const heroImage = getPostImageUrl(post);
font-size: 1.375rem;
font-weight: 700;
margin: 1.75rem 0 1rem;
font-family: 'Merriweather', Georgia, serif;
display: flex;
align-items: baseline;
gap: 0.5rem;
}
.post-content :global(p) {
@ -148,11 +158,19 @@ const heroImage = getPostImageUrl(post);
}
.post-content :global(h2) {
font-size: 1.5rem;
font-size: 1.15rem;
}
.post-content :global(h3) {
font-size: 1.25rem;
font-size: 1.05rem;
}
.post-content :global(p) {
font-size: 0.9rem;
}
.post-content :global(li) {
font-size: 0.9rem;
}
}
</style>