Новые изменения в компоенты

This commit is contained in:
Web-serfer 2026-04-26 22:45:19 +05:00
parent a14c18542e
commit faf02848ed
3 changed files with 33 additions and 19 deletions

View file

@ -27,7 +27,7 @@ const { items } = Astro.props;
</aside>
)}
<style>
<style is:global>
.toc-container { width: 100%; }
.toc-nav {
background: #ffffff;
@ -43,6 +43,7 @@ const { items } = Astro.props;
margin: 0 0 1.25rem;
padding-bottom: 0.75rem;
border-bottom: 2px solid #eac26e;
text-align: center;
}
.toc-list {
@ -55,10 +56,19 @@ const { items } = Astro.props;
gap: 0.25rem;
}
/* ЧЕРНАЯ НУМЕРАЦИЯ */
.toc-item.level-2 { counter-reset: toc-h3; counter-increment: toc-h2; }
/* Поддержка level=1 (из HTML h2) и level=2/3 */
.toc-item.level-1, .toc-item.level-2 { counter-reset: toc-h3; counter-increment: toc-h2; }
.toc-item.level-3 { counter-increment: toc-h3; padding-left: 1.25rem; }
/* h2 = level 1 в HTML */
.toc-item.level-1, .toc-item.level-2 {
font-weight: 600;
}
.toc-item.level-1 .toc-link, .toc-item.level-2 .toc-link {
font-size: 0.95rem;
padding: 0.6rem 0.75rem;
}
.toc-link {
display: flex;
padding: 0.5rem 0.75rem;
@ -70,19 +80,21 @@ const { items } = Astro.props;
transition: all 0.2s ease;
}
/* Номера в оглавлении */
.toc-link::before {
content: "";
display: inline-block;
width: 1.5rem;
color: #1e3050;
font-weight: 700;
margin-right: 0.6rem;
flex-shrink: 0;
text-align: center;
}
.level-2 .toc-link::before { content: counter(toc-h2) "."; }
.level-3 .toc-link::before { content: counter(toc-h2) "." counter(toc-h3) "."; font-size: 0.85em; opacity: 0.7; }
.toc-item.level-1 .toc-link::before, .toc-item.level-2 .toc-link::before { content: counter(toc-h2) "."; }
.toc-item.level-3 .toc-link::before { content: counter(toc-h2) "." counter(toc-h3) "."; font-size: 0.85em; opacity: 0.7; }
.toc-link:hover { color: #1e3050; background: #f1f5f9; }
/* АКТИВНЫЙ ПУНКТ (При скролле) */
.toc-item.active .toc-link {
color: #eac26e;
font-weight: 700;