From d97a9266242aa91238585c85c59fa92214d44d40 Mon Sep 17 00:00:00 2001 From: Claas Date: Sun, 18 May 2025 19:21:21 +0200 Subject: [PATCH] Improve --- public/diagonal-stripes.svg | 5 +++++ src/App.tsx | 15 ++++++++------ src/components/UrlForm.tsx | 8 ++++++++ src/components/UrlItem.tsx | 41 ++++++++++++++++++++++--------------- src/getDocument.ts | 3 ++- src/index.css | 12 +++++++++++ src/transition.ts | 6 ++++++ 7 files changed, 67 insertions(+), 23 deletions(-) create mode 100644 public/diagonal-stripes.svg create mode 100644 src/transition.ts diff --git a/public/diagonal-stripes.svg b/public/diagonal-stripes.svg new file mode 100644 index 0000000..1237279 --- /dev/null +++ b/public/diagonal-stripes.svg @@ -0,0 +1,5 @@ + + + + diff --git a/src/App.tsx b/src/App.tsx index a4a4d9f..ced7b8f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,7 @@ import { createEffect, createSignal, For } from "solid-js"; import UrlForm from "./components/UrlForm"; import UrlItem from "./components/UrlItem"; +import transition from "./transition"; const URI_LIST = "text/uri-list"; @@ -53,13 +54,15 @@ export default function App() { function handleUrlSubmit(url: URL) { console.debug("Submitted url", url); //TODO use map to deduplicate and reduce garbage - setUrls((urls) => { - const index = urls.findIndex((otherUrl) => otherUrl.href === url.href); + transition(() => { + setUrls((urls) => { + const index = urls.findIndex((otherUrl) => otherUrl.href === url.href); - console.debug("Found url", index); - if (index !== -1) return urls; + console.debug("Found url", index); + if (index !== -1) return urls; - return [...urls, url]; + return [...urls, url]; + }); }); } @@ -73,7 +76,7 @@ export default function App() {

Add Destination

Destinations

-