Jacky Zhao
2025-03-24 fe2e16d937e2b57fb2bb1d10dea47db7256a4a49
quartz/components/styles/toc.scss
@@ -1,22 +1,54 @@
details.toc {
  & summary {
    cursor: pointer;
@use "../../styles/variables.scss" as *;
    list-style: none;
    &::marker, &::-webkit-details-marker {
      display: none;
    }
.toc {
  display: flex;
  flex-direction: column;
    & > * {
      display: inline-block;
      margin: 0;
    }
    & > h3 {
      font-size: 1rem;
    }
  overflow-y: hidden;
  min-height: 4rem;
  flex: 0 1 auto;
  &:has(button.toc-header.collapsed) {
    flex: 0 1 1.2rem;
  }
}
@media all and not ($mobile) {
  .toc-header {
    display: flex;
  }
}
button.toc-header {
  background-color: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 0;
  color: var(--dark);
  display: flex;
  align-items: center;
  & h3 {
    font-size: 1rem;
    display: inline-block;
    margin: 0;
  }
  & .fold {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    opacity: 0.8;
  }
  &.collapsed .fold {
    transform: rotateZ(-90deg);
  }
}
.toc-content {
  list-style: none;
  position: relative;
  & ul {
    list-style: none;
    margin: 0.5rem 0;
@@ -24,7 +56,9 @@
    & > li > a {
      color: var(--dark);
      opacity: 0.35;
      transition: 0.5s ease opacity;
      transition:
        0.5s ease opacity,
        0.3s ease color;
      &.in-view {
        opacity: 0.75;
      }