Skip to content

Commit

Permalink
minimap - use onNavigateToPath prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Wattenberger committed Dec 2, 2021
1 parent 74fb7b9 commit 9ccc6b3
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/blocks/folder-blocks/minimap/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useEffect, useMemo, useState } from "react";
import { useMemo } from "react";
// @ts-ignore
import { Tree } from "./Tree.jsx"
import { FolderBlockProps, getNestedFileTree, } from "@githubnext/utils";

export default function (props: FolderBlockProps) {
const { tree } = props;
const { tree, onNavigateToPath } = props;

const data = useMemo(() => {
const nestedTree = getNestedFileTree(tree)[0]
Expand All @@ -22,12 +22,7 @@ export default function (props: FolderBlockProps) {
<Tree
data={data}
onClickFile={(path: string) => {
if ('URLSearchParams' in window) {
var searchParams = new URLSearchParams(window.location.search);
searchParams.set("path", path);
var newRelativePathQuery = window.location.pathname + '?' + searchParams.toString();
history.pushState(null, '', newRelativePathQuery);
}
onNavigateToPath(path);
}}
/>
</div>
Expand Down

0 comments on commit 9ccc6b3

Please sign in to comment.