Skip to content

Commit

Permalink
fix: properly compute relative path for explorer (closes jackyzha0#1055
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 authored and wingadium1 committed Aug 12, 2024
1 parent e2026c3 commit f4fe461
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions quartz/components/ExplorerNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro
const isDefaultOpen = opts.folderDefaultState === "open"

// Calculate current folderPath
let folderPath = ""
if (node.name !== "") {
folderPath = joinSegments(fullPath ?? "", node.name)
}
const folderPath = node.name !== "" ? joinSegments(fullPath ?? "", node.name) : ""
const href = resolveRelative(fileData.slug!, folderPath as SimpleSlug) + "/"

return (
<>
Expand Down Expand Up @@ -205,11 +203,7 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro
{/* render <a> tag if folderBehavior is "link", otherwise render <button> with collapse click event */}
<div key={node.name} data-folderpath={folderPath}>
{folderBehavior === "link" ? (
<a
href={resolveRelative(fileData.slug!, folderPath as SimpleSlug)}
data-for={node.name}
class="folder-title"
>
<a href={href} data-for={node.name} class="folder-title">
{node.displayName}
</a>
) : (
Expand Down

0 comments on commit f4fe461

Please sign in to comment.