From 95aeec3380f17f3361a136cc55752a7c4b8f3740 Mon Sep 17 00:00:00 2001 From: wukko Date: Mon, 17 Jun 2024 01:00:18 +0600 Subject: [PATCH] web: tab bar pagination effect & smooth scroll --- web/src/components/sidebar/SidebarTab.svelte | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/src/components/sidebar/SidebarTab.svelte b/web/src/components/sidebar/SidebarTab.svelte index 87bf8cd0..563564f0 100644 --- a/web/src/components/sidebar/SidebarTab.svelte +++ b/web/src/components/sidebar/SidebarTab.svelte @@ -4,13 +4,23 @@ export let tabName: string; export let tabLink: string; + const firstTabs = [ + "save", + "trim", + "crop", + "convert" + ]; + let tab: HTMLElement; $: isTabActive = $page.url.pathname === tabLink; const showTab = (e: HTMLElement | undefined) => { if (e) { - e.scrollIntoView({}); + e.scrollIntoView({ + inline: firstTabs.includes(tabName) ? 'end' : 'start', + behavior: 'smooth' + }); } }