[+] Clickable breadcrumb
This commit is contained in:
+7
-1
@@ -41,6 +41,11 @@ function getHref(f: File)
|
|||||||
return f.type == "directory" ? urlJoin(path, f.name) : urlJoin(host, path, f.name)
|
return f.type == "directory" ? urlJoin(path, f.name) : urlJoin(host, path, f.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getParent(level: number)
|
||||||
|
{
|
||||||
|
return urlJoin(path, "../")
|
||||||
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [api] = createResource(fetchApi)
|
const [api] = createResource(fetchApi)
|
||||||
const paths = [window.location.host, ...path.split("/").filter(it => it)]
|
const paths = [window.location.host, ...path.split("/").filter(it => it)]
|
||||||
@@ -59,7 +64,8 @@ export default function App() {
|
|||||||
<Icon icon="ion:wifi-outline" class="text-xl"/>
|
<Icon icon="ion:wifi-outline" class="text-xl"/>
|
||||||
<For each={paths}>{(p, i) =>
|
<For each={paths}>{(p, i) =>
|
||||||
<>
|
<>
|
||||||
<span class="color-sub" classList={{active: i() + 1 == paths.length}}>{p}</span>
|
<a class="breadcrumb-link" classList={{active: i() + 1 == paths.length}}
|
||||||
|
href={urlJoin(path, "../".repeat(paths.length - i() - 1))}>{p}</a>
|
||||||
<span class="color-subsub last:hidden">/</span>
|
<span class="color-subsub last:hidden">/</span>
|
||||||
</>
|
</>
|
||||||
}</For>
|
}</For>
|
||||||
|
|||||||
+4
-2
@@ -30,5 +30,7 @@ iconify-icon
|
|||||||
align-items: center
|
align-items: center
|
||||||
justify-content: center
|
justify-content: center
|
||||||
|
|
||||||
.color-sub.active
|
.breadcrumb-link.active
|
||||||
@extend .color-emp
|
@extend .color-emp
|
||||||
|
pointer-events: none
|
||||||
|
cursor: default
|
||||||
Reference in New Issue
Block a user