design: improve tabs design
This commit is contained in:
9 files changed
+124
-172
No files matched your search
@@ -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?.()}
|
||||
|
||||
@@ -22,39 +22,34 @@
|
||||
{/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={[
|
||||
{
|
||||
href: '/admin/config',
|
||||
name: $t('routes.admin.config.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/applications',
|
||||
name: $t('routes.admin.applications.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/taglines',
|
||||
name: $t('routes.admin.taglines.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/team',
|
||||
name: $t('routes.admin.team.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/federation',
|
||||
name: $t('routes.admin.federation.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/media',
|
||||
name: $t('routes.admin.media.title'),
|
||||
},
|
||||
]}
|
||||
class="overflow-auto"
|
||||
/>
|
||||
</div>
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/admin/config',
|
||||
name: $t('routes.admin.config.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/applications',
|
||||
name: $t('routes.admin.applications.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/taglines',
|
||||
name: $t('routes.admin.taglines.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/team',
|
||||
name: $t('routes.admin.team.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/federation',
|
||||
name: $t('routes.admin.federation.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/media',
|
||||
name: $t('routes.admin.media.title'),
|
||||
},
|
||||
]}
|
||||
class="overflow-auto"
|
||||
/>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -20,21 +20,17 @@
|
||||
</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={[
|
||||
{
|
||||
href: `${communityUrl}/settings`,
|
||||
name: $t('routes.community.settings.settings'),
|
||||
},
|
||||
{
|
||||
href: `${communityUrl}/settings/team`,
|
||||
name: $t('routes.community.settings.team'),
|
||||
},
|
||||
]}
|
||||
></Tabs>
|
||||
</div>
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: `${communityUrl}/settings`,
|
||||
name: $t('routes.community.settings.settings'),
|
||||
},
|
||||
{
|
||||
href: `${communityUrl}/settings/team`,
|
||||
name: $t('routes.community.settings.team'),
|
||||
},
|
||||
]}
|
||||
></Tabs>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -1,47 +1,29 @@
|
||||
<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
|
||||
routes={[
|
||||
{
|
||||
href: '/inbox',
|
||||
name: $t('filter.location.all'),
|
||||
},
|
||||
{
|
||||
href: '/inbox?type=replies',
|
||||
name: $t('filter.inbox.replies'),
|
||||
},
|
||||
{
|
||||
href: '/inbox?type=mentions',
|
||||
name: $t('filter.inbox.mentions'),
|
||||
},
|
||||
{
|
||||
href: '/inbox/messages',
|
||||
name: $t('filter.inbox.messages'),
|
||||
},
|
||||
]}
|
||||
class="overflow-auto"
|
||||
/>
|
||||
</div>
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/inbox',
|
||||
name: $t('filter.location.all'),
|
||||
},
|
||||
{
|
||||
href: '/inbox?type=replies',
|
||||
name: $t('filter.inbox.replies'),
|
||||
},
|
||||
{
|
||||
href: '/inbox?type=mentions',
|
||||
name: $t('filter.inbox.mentions'),
|
||||
},
|
||||
{
|
||||
href: '/inbox/messages',
|
||||
name: $t('filter.inbox.messages'),
|
||||
},
|
||||
]}
|
||||
class="overflow-auto"
|
||||
/>
|
||||
{@render children?.()}
|
||||
@@ -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}
|
||||
|
||||
@@ -6,19 +6,14 @@
|
||||
</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
|
||||
routes={[
|
||||
{
|
||||
href: '/instances/linked',
|
||||
name: 'Linked',
|
||||
},
|
||||
{ href: '/instances/blocked', name: 'Blocked' },
|
||||
]}
|
||||
></Tabs>
|
||||
</div>
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/instances/linked',
|
||||
name: 'Linked',
|
||||
},
|
||||
{ href: '/instances/blocked', name: 'Blocked' },
|
||||
]}
|
||||
></Tabs>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
{@render children?.()}
|
||||
@@ -10,22 +10,18 @@
|
||||
</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={[
|
||||
{
|
||||
href: '/moderation',
|
||||
name: $t('routes.moderation.feed'),
|
||||
},
|
||||
{
|
||||
href: '/moderation/communities',
|
||||
name: $t('routes.communities.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<Tabs
|
||||
class="overflow-auto"
|
||||
routes={[
|
||||
{
|
||||
href: '/moderation',
|
||||
name: $t('routes.moderation.feed'),
|
||||
},
|
||||
{
|
||||
href: '/moderation/communities',
|
||||
name: $t('routes.communities.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -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={[
|
||||
|
||||
@@ -9,39 +9,34 @@
|
||||
</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={[
|
||||
{
|
||||
href: '/util',
|
||||
name: 'Home',
|
||||
},
|
||||
{
|
||||
href: '/util/instance',
|
||||
name: 'Photon instance',
|
||||
},
|
||||
{
|
||||
href: '/util/photonify',
|
||||
name: 'Photonify Links',
|
||||
},
|
||||
{
|
||||
href: '/util/placeholder',
|
||||
name: 'Placeholders',
|
||||
},
|
||||
{
|
||||
href: '/util/constants',
|
||||
name: 'Constants',
|
||||
},
|
||||
{
|
||||
href: '/functions',
|
||||
name: 'Functions',
|
||||
},
|
||||
]}
|
||||
class="overflow-auto"
|
||||
currentRoute={page.url.toString()}
|
||||
/>
|
||||
</div>
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/util',
|
||||
name: 'Home',
|
||||
},
|
||||
{
|
||||
href: '/util/instance',
|
||||
name: 'Photon instance',
|
||||
},
|
||||
{
|
||||
href: '/util/photonify',
|
||||
name: 'Photonify Links',
|
||||
},
|
||||
{
|
||||
href: '/util/placeholder',
|
||||
name: 'Placeholders',
|
||||
},
|
||||
{
|
||||
href: '/util/constants',
|
||||
name: 'Constants',
|
||||
},
|
||||
{
|
||||
href: '/functions',
|
||||
name: 'Functions',
|
||||
},
|
||||
]}
|
||||
class="overflow-auto"
|
||||
/>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
Reference in new issue
Block a user