From d45b6e273f535d635018f3fa02a1dae614d0564d Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Thu, 9 Feb 2023 21:23:16 -0500 Subject: [PATCH] [+] Scrollable breadcrumbs --- src/App.tsx | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index ef58566..5787089 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,7 @@ import urlJoin from 'url-join'; import mime from 'mime'; import moment from 'moment'; -import { createResource, For, Show } from 'solid-js'; +import { createResource, createSignal, For, Show } from 'solid-js'; import tippy from 'tippy.js'; import 'tippy.js/dist/tippy.css'; @@ -47,9 +47,24 @@ function getParent(level: number) } export default function App() { + let bcWheel: HTMLDivElement const [api] = createResource(fetchApi) + const [bcLeft, setBcLeft] = createSignal(0) const paths = [window.location.host, ...path.split("/").filter(it => it)] + function wheel(e: WheelEvent) + { + let direction = (e.detail < 0 || e.deltaY > 0) ? 1 : -1 + let dx = direction * 15 + + const rect = bcWheel.getBoundingClientRect() + const prect = bcWheel.parentElement.getBoundingClientRect() + const max = Math.round(rect.width - prect.width) + + setBcLeft(Math.min(Math.max(bcLeft() + dx, 0), max)) + console.log(e) + } + return ( // Full screen container
@@ -60,15 +75,21 @@ export default function App() {

File Listing

{/* Breadcrumbs */} -