web: tab bar pagination effect & smooth scroll

This commit is contained in:
wukko 2024-06-17 01:00:18 +06:00
parent 2ea3ca1a07
commit 95aeec3380
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -4,13 +4,23 @@
export let tabName: string; export let tabName: string;
export let tabLink: string; export let tabLink: string;
const firstTabs = [
"save",
"trim",
"crop",
"convert"
];
let tab: HTMLElement; let tab: HTMLElement;
$: isTabActive = $page.url.pathname === tabLink; $: isTabActive = $page.url.pathname === tabLink;
const showTab = (e: HTMLElement | undefined) => { const showTab = (e: HTMLElement | undefined) => {
if (e) { if (e) {
e.scrollIntoView({}); e.scrollIntoView({
inline: firstTabs.includes(tabName) ? 'end' : 'start',
behavior: 'smooth'
});
} }
} }