design: improve tabs design

This commit is contained in:
James Xylight committed 2025-08-21 17:43:44 -07:00
1 parent f5422f976b
commit 6303dc224c
9 files changed
+15 -63

No files matched your search

+9 -14
View File
@@ -28,26 +28,21 @@
}
</script>
<nav
class="flex flex-row items-center gap-1 p-1 rounded-full bg-white/60 dark:bg-zinc-900/60
backdrop-blur-lg border border-slate-200 dark:border-zinc-800 shadow-sm {clazz ??
''}
"
>
<nav class="flex flex-row items-center gap-8 p-1 justify-start">
{#each routes as route (route.href)}
{@const selected = isSelected(
page.url,
new SvelteURL(`${page.url.origin}${route.href}`),
)}
<a
onclick={() => invalidateAll()}
href={buildUrl(currentRoute, route.href)}
class="font-medium rounded-full px-4 py-1 hover:bg-slate-200/40 dark:hover:bg-zinc-700/40
transition-colors duration-100 relative z-0 shrink-0"
class={[
'rounded-full transition-colors duration-100 relative z-0 shrink-0',
selected ? 'font-medium' : 'text-slate-600 dark:text-zinc-400',
]}
>
{route.name}
{#if isSelected(page.url, new SvelteURL(`${page.url.origin}${route.href}`))}
<div
class="rounded-full bg-slate-200/60 dark:bg-zinc-700/60
absolute inset-0 w-full h-full -z-10"
></div>
{/if}
</a>
{/each}
{@render children?.()}
-5
View File
@@ -22,10 +22,6 @@
{/if}
<div class="flex flex-col gap-4 h-full">
<div
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2
top-6 lg:top-22"
>
<Tabs
routes={[
{
@@ -55,6 +51,5 @@
]}
class="overflow-auto"
/>
</div>
{@render children?.()}
</div>
@@ -20,9 +20,6 @@
</script>
<div class="flex flex-col gap-4 h-full">
<div
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
>
<Tabs
routes={[
{
@@ -35,6 +32,5 @@
},
]}
></Tabs>
</div>
{@render children?.()}
</div>
+2 -20
View File
@@ -1,28 +1,11 @@
<script lang="ts">
import { page } from '$app/state'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import { t } from '$lib/i18n/translations'
import { SvelteURLSearchParams } from 'svelte/reactivity'
let { children } = $props()
function addSearchParam(
currentSearchParams: URLSearchParams,
newParamString: string,
) {
const updatedParams = new SvelteURLSearchParams(currentSearchParams)
const newParam = new SvelteURLSearchParams(newParamString)
const [key, value]: [string, string] = newParam.entries().next().value!
updatedParams.set(key, value)
return updatedParams
}
</script>
<div
class="mt-4 mb-2 z-30 mx-auto max-w-full flex gap-2 md:flex-row flex-col
items-center px-2 w-max top-6 lg:top-22"
>
<Tabs
<Tabs
routes={[
{
href: '/inbox',
@@ -42,6 +25,5 @@ items-center px-2 w-max top-6 lg:top-22"
},
]}
class="overflow-auto"
/>
</div>
/>
{@render children?.()}
+1 -1
View File
@@ -160,7 +160,7 @@
</CommonList>
{#if res.private_messages.length == 50 || data.page != 1}
<div class="mt-auto pb-4">
<div class="mt-auto pb-4 mx-auto">
<Pageination
page={data.page}
hasMore={res.private_messages.length == 50}
+2 -7
View File
@@ -6,11 +6,7 @@
</script>
<Header pageHeader>Instances</Header>
<div
class="mt-4 mb-2 z-30 mx-auto max-w-full flex gap-2 md:flex-row flex-col
items-center px-2 w-max top-6 lg:top-22"
>
<Tabs
<Tabs
routes={[
{
href: '/instances/linked',
@@ -18,7 +14,6 @@ items-center px-2 w-max top-6 lg:top-22"
},
{ href: '/instances/blocked', name: 'Blocked' },
]}
></Tabs>
</div>
></Tabs>
<div class="h-3 sm:h-6"></div>
{@render children?.()}
-4
View File
@@ -10,9 +10,6 @@
</svelte:head>
<div class="w-full space-y-4 pb-8">
<div
class="sticky w-max mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
>
<Tabs
class="overflow-auto"
routes={[
@@ -26,6 +23,5 @@
},
]}
/>
</div>
{@render children?.()}
</div>
+1 -3
View File
@@ -25,9 +25,7 @@
</svelte:head>
<div class="flex flex-col gap-4 h-full z-0">
<div
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
>
<div class="flex flex-row justify-between">
<Tabs
class="overflow-auto"
routes={[
-5
View File
@@ -9,9 +9,6 @@
</script>
<div class="flex flex-col gap-2">
<div
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
>
<Tabs
routes={[
{
@@ -40,8 +37,6 @@
},
]}
class="overflow-auto"
currentRoute={page.url.toString()}
/>
</div>
{@render children?.()}
</div>