From ef72f1bf707dca363cdab84da91e2acfaef8f276 Mon Sep 17 00:00:00 2001
From: Ammar Alakkad <am.alakkad@gmail.com>
Date: Mon, 30 Dec 2024 16:03:57 +0000
Subject: [PATCH] Fix ObsidianFlavoredMarkdown source link (#1694)

---
 quartz/components/styles/toc.scss |   94 ++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 80 insertions(+), 14 deletions(-)

diff --git a/quartz/components/styles/toc.scss b/quartz/components/styles/toc.scss
index 33b9cca..4988cd8 100644
--- a/quartz/components/styles/toc.scss
+++ b/quartz/components/styles/toc.scss
@@ -1,25 +1,91 @@
-details.toc {
-  & summary {
-    cursor: pointer;
+@use "../../styles/variables.scss" as *;
 
-    &::marker {
-      color: var(--dark);
-    }
+.toc {
+  display: flex;
+  flex-direction: column;
 
-    & > * {
-      padding-left: 0.25rem;
-      display: inline-block;
-      margin: 0;
-    }
+  &.desktop-only {
+    max-height: 40%;
   }
-    
+}
+
+@media all and not ($mobile) {
+  .toc {
+    display: flex;
+  }
+}
+
+button#toc {
+  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;
+  overflow: hidden;
+  overflow-y: auto;
+  max-height: 100%;
+  transition:
+    max-height 0.35s ease,
+    visibility 0s linear 0s;
+  position: relative;
+  visibility: visible;
+
+  &.collapsed {
+    max-height: 0;
+    transition:
+      max-height 0.35s ease,
+      visibility 0s linear 0.35s;
+    visibility: hidden;
+  }
+
+  &.collapsed > .overflow::after {
+    opacity: 0;
+  }
+
   & ul {
     list-style: none;
-    margin: 0.5rem 1.25rem;
+    margin: 0.5rem 0;
     padding: 0;
+    & > li > a {
+      color: var(--dark);
+      opacity: 0.35;
+      transition:
+        0.5s ease opacity,
+        0.3s ease color;
+      &.in-view {
+        opacity: 0.75;
+      }
+    }
+  }
+  > ul.overflow {
+    max-height: none;
+    width: 100%;
   }
 
-  @for $i from 1 through 6 {
+  @for $i from 0 through 6 {
     & .depth-#{$i} {
       padding-left: calc(1rem * #{$i});
     }

--
Gitblit v1.10.0