_toc.scss 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. // Вложенный список (второй уровень) - с маркерами
  58. &--nested {
  59. padding: 8px 0 0 28px;
  60. list-style: disc;
  61. padding-left: 40px;
  62. }
  63. }
  64. &__item {
  65. margin-bottom: 8px;
  66. position: relative;
  67. &:last-child {
  68. margin-bottom: 0;
  69. }
  70. // Нумерация только для первого уровня
  71. > .toc__link::before {
  72. counter-increment: toc-counter;
  73. content: counter(toc-counter) ". ";
  74. font-weight: 600;
  75. margin-right: 4px;
  76. }
  77. // Убираем нумерацию для вложенного уровня
  78. .toc__list--nested > & > .toc__link::before {
  79. content: none;
  80. }
  81. }
  82. &__link {
  83. display: block;
  84. color: var(--text-color);
  85. text-decoration: none;
  86. font-size: 14px;
  87. line-height: 20px;
  88. padding: 6px 12px;
  89. border-radius: 6px;
  90. transition: all 0.2s ease;
  91. &:hover {
  92. background-color: rgba(0, 0, 0, 0.03);
  93. color: var(--link-color);
  94. }
  95. // Стили для вложенного уровня
  96. .toc__list--nested > .toc__item > & {
  97. font-size: 13px;
  98. padding-left: 8px;
  99. }
  100. }
  101. // Active state (открыто)
  102. &.active {
  103. .toc__header::before {
  104. transform: translateY(-50%) rotate(45deg);
  105. }
  106. .toc__header::after {
  107. transform: translateY(-50%) rotate(-45deg);
  108. }
  109. .toc__content {
  110. max-height: 1000px;
  111. }
  112. }
  113. }