_toc.scss 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. .toc {
  2. border-radius: 12px;
  3. border: 1px solid var(--content-border-color);
  4. background: var(--content-bg-color);
  5. overflow: hidden;
  6. &__header {
  7. padding: 20px 56px 20px 24px;
  8. cursor: pointer;
  9. position: relative;
  10. user-select: none;
  11. transition: background-color 0.2s ease;
  12. &:hover {
  13. background-color: rgba(0, 0, 0, 0.02);
  14. }
  15. // Крестик с псевдоэлементами
  16. &::before,
  17. &::after {
  18. content: '';
  19. position: absolute;
  20. right: 24px;
  21. top: 50%;
  22. width: 16px;
  23. height: 2px;
  24. background-color: var(--text-color);
  25. transition: transform 0.3s ease;
  26. }
  27. &::before {
  28. transform: translateY(-50%) rotate(90deg);
  29. }
  30. &::after {
  31. transform: translateY(-50%);
  32. }
  33. }
  34. &__title {
  35. margin: 0;
  36. color: var(--Main-Back, #000);
  37. font-size: 18px;
  38. font-style: normal;
  39. font-weight: 700;
  40. line-height: normal;
  41. text-transform: uppercase;
  42. color: var(--text-color);
  43. @include mobile{
  44. font-size:16px;
  45. }
  46. }
  47. &__content {
  48. max-height: 0;
  49. overflow: hidden;
  50. transition: max-height 0.3s ease;
  51. }
  52. &__list {
  53. list-style: none;
  54. margin: 0;
  55. padding: 0 24px 24px 24px;
  56. counter-reset: toc-counter;
  57. @include mobile{
  58. padding: 0 16px 16px 16px;
  59. }
  60. // Вложенный список (второй уровень) - с маркерами
  61. &--nested {
  62. padding: 8px 0 0 28px;
  63. list-style: disc;
  64. padding-left: 40px;
  65. }
  66. }
  67. &__item {
  68. margin-bottom: 8px;
  69. position: relative;
  70. &:last-child {
  71. margin-bottom: 0;
  72. }
  73. // Нумерация только для первого уровня
  74. > .toc__link::before {
  75. counter-increment: toc-counter;
  76. content: counter(toc-counter) ". ";
  77. font-weight: 600;
  78. margin-right: 4px;
  79. }
  80. // Убираем нумерацию для вложенного уровня
  81. .toc__list--nested > & > .toc__link::before {
  82. content: none;
  83. }
  84. }
  85. &__link {
  86. display: block;
  87. color: var(--text-color);
  88. text-decoration: none;
  89. font-size: 14px;
  90. line-height: 20px;
  91. padding: 6px 12px;
  92. border-radius: 6px;
  93. transition: all 0.2s ease;
  94. &:hover {
  95. color: var(--link-color);
  96. }
  97. // Стили для вложенного уровня
  98. .toc__list--nested > .toc__item > & {
  99. font-size: 13px;
  100. padding-left: 8px;
  101. }
  102. }
  103. // Active state (открыто)
  104. &.active {
  105. .toc__header::before {
  106. transform: translateY(-50%) rotate(45deg);
  107. }
  108. .toc__header::after {
  109. transform: translateY(-50%) rotate(-45deg);
  110. }
  111. .toc__content {
  112. max-height: 1000px;
  113. }
  114. }
  115. }