feat: new centered layout

This commit is contained in:
Xyphyn committed 2023-10-03 18:06:24 -07:00
1 parent 0d08df2ad5
commit f617f54334
11 files changed
+179 -70

No files matched your search

@@ -14,7 +14,7 @@
<div
class="flex flex-col {$userSettings.view == 'card'
? 'gap-3 md:gap-4'
: ''} divide-slate-200 dark:divide-zinc-800 z-[5]"
: ''} divide-slate-200 dark:divide-zinc-800"
class:divide-y={$userSettings.view != 'card'}
>
{#if posts.length == 0}
+1 -1
View File
@@ -24,7 +24,7 @@
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-positive-tabindex -->
<div
class="fixed top-0 left-0 w-screen h-screen overflow-auto bg-black/50
class="isolate fixed backdrop-blur-sm top-0 left-0 w-screen h-screen overflow-auto bg-black/50
flex flex-col z-[200] overscroll-contain"
transition:fade={{ duration: 200 }}
on:click={() => (open = false)}
+4 -2
View File
@@ -46,9 +46,11 @@
</script>
<nav
class="flex flex-row gap-2 items-center sticky top-0 bg-slate-50/80
dark:bg-black/80 backdrop-blur-3xl w-full mx-auto px-4 py-2 z-50 box-border h-16
class="flex flex-row gap-2 items-center
backdrop-blur-3xl w-full mx-auto px-4 py-2 z-50 box-border h-16
{$$props.class}
"
style={$$props.style}
>
<div class="flex flex-row gap-2 items-center mr-auto">
<a href="/" class="flex flex-row items-center gap-2 logo group">
+2 -2
View File
@@ -1,6 +1,6 @@
<aside
class="sticky top-16 break-words flex
flex-col gap-4 p-6 max-w-full 2xl:w-96 w-80 max-h-[calc(100svh-4rem)]
class="sticky top-16 left-0 break-words flex flex-shrink
flex-col gap-4 p-6 max-w-full w-full max-h-[calc(100svh-8rem)]
overflow-auto text-sm border-slate-200 dark:border-zinc-800 {$$props.class}"
>
<slot />
+78 -1
View File
@@ -1,7 +1,84 @@
<script lang="ts">
import Navbar from '$lib/components/ui/Navbar.svelte'
import { userSettings } from '$lib/settings.js'
import { routes } from '$lib/util.js'
export let route: { id: string } | undefined = undefined
export let route: { id: string | null } | undefined = undefined
$: title = route ? routes[(route.id as keyof typeof routes) ?? ''] : ''
let scroll = 0
</script>
<svelte:window bind:scrollY={scroll} />
<div class="shell {$$props.class}">
<slot
name="navbar"
class="sticky top-0 border-b border-slate-200 dark:border-zinc-900
{scroll > 0
? 'bg-slate-50/70 dark:bg-zinc-950/70'
: 'bg-slate-50 dark:bg-zinc-950'} transition-colors duration-500"
style="grid-area: navbar"
{title}
/>
<div
class="content md:divide-x divide-slate-200 dark:divide-zinc-900 {$userSettings.newWidth
? 'limit-width'
: ''}"
>
<slot
name="sidebar"
class="hidden md:flex sticky top-16 justify-self-end left-0 w-full max-w-full"
style="grid-area: sidebar; max-width: 20rem;"
/>
<slot
name="main"
class="w-full bg-slate-25 dark:bg-transparent justify-self-center"
style="grid-area: main"
/>
<slot
name="suffix"
class="hidden xl:flex w-full justify-self-start"
style="grid-area: suffix; max-width: 20rem;"
/>
</div>
</div>
<style>
.shell {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto 1fr;
grid-template-areas:
'navbar'
'content';
}
.content {
width: 100%;
display: grid;
margin-left: auto;
margin-right: auto;
grid-area: content;
grid-template-columns: 1fr;
grid-template-areas: 'sidebar main suffix';
justify-items: end center start;
}
@media (min-width: 768px) {
.content {
grid-template-columns: 1fr 2fr;
}
}
@media (min-width: 1280px) {
.content {
grid-template-columns: 1fr 2fr 1fr;
}
}
.limit-width {
max-width: 96rem;
}
</style>
@@ -30,9 +30,15 @@
slot="prefix"
/>
</div>
<span class="max-w-full break-words" class:hidden={!expanded}>
{follow.title}
</span>
<div
class="flex flex-col max-w-full break-words"
class:hidden={!expanded}
>
<span>{follow.title}</span>
<span class="text-xs text-slate-600 dark:text-zinc-400">
{new URL(follow.actor_id).hostname}
</span>
</div>
</Button>
</div>
{/each}
+23 -16
View File
@@ -1,7 +1,6 @@
<script lang="ts">
import {
ArrowLeftOnRectangle,
ChevronDoubleLeft,
Cog6Tooth,
GlobeAlt,
Home,
@@ -18,16 +17,19 @@
import { flip } from 'svelte/animate'
import { expoOut } from 'svelte/easing'
import { Button } from 'mono-svelte'
export let route = ''
</script>
<nav
class="hidden sm:flex flex-col pl-4 pr-4 py-4 overflow-auto sticky top-16 bottom-0
gap-1 max-h-[calc(100svh-4rem)] w-full bg-slate-50 dark:bg-black
class="flex flex-col pl-4 pr-4 py-4 overflow-auto
gap-1 max-h-[calc(100svh-4rem)]
{$userSettings.expandSidebar
? 'max-w-[25%] resize-x min-w-[12rem]'
? ''
: 'w-max max-w-max min-w-max'} {$$props.class}"
style={$$props.style}
>
<Button
<!-- <Button
on:click={() =>
($userSettings.expandSidebar = !$userSettings.expandSidebar)}
class="w-max !p-2"
@@ -42,18 +44,23 @@
: 'rotate-180'}"
title="Toggle Sidebar"
/>
</Button>
</Button> -->
<SidebarButton href="/" expanded={$userSettings.expandSidebar}>
<Icon src={Home} mini size="20" title="Frontpage" />
<span class:hidden={!$userSettings.expandSidebar}>Frontpage</span>
<Icon src={Home} mini={route == '/'} size="20" title="Frontpage" />
<span>Frontpage</span>
</SidebarButton>
<SidebarButton href="/settings" expanded={$userSettings.expandSidebar}>
<Icon src={Cog6Tooth} mini size="20" title="Settings" />
<span class:hidden={!$userSettings.expandSidebar}>Settings</span>
<Icon
src={Cog6Tooth}
mini={route == '/settings'}
size="20"
title="Settings"
/>
<span>Settings</span>
</SidebarButton>
<SidebarButton expanded={$userSettings.expandSidebar} href="/communities">
<Icon mini src={GlobeAlt} size="20" />
<span class:hidden={!$userSettings.expandSidebar}>Communities</span>
<Icon mini={route == '/communities'} src={GlobeAlt} size="20" />
<span>Communities</span>
</SidebarButton>
{#if $profileData.profiles.length >= 1}
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
@@ -64,7 +71,7 @@
{/each}
<SidebarButton href="/accounts" expanded={$userSettings.expandSidebar}>
<Icon src={UserGroup} mini size="20" />
<span class:hidden={!$userSettings.expandSidebar}>Accounts</span>
<span>Accounts</span>
</SidebarButton>
{/if}
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
@@ -90,7 +97,7 @@
title="Log In"
>
<Icon mini src={ArrowLeftOnRectangle} size="20" />
<span class:hidden={!$userSettings.expandSidebar}>Log In</span>
<span>Log In</span>
</Button>
<Button
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
@@ -100,7 +107,7 @@
title="Sign Up"
>
<Icon mini src={Identification} size="20" />
<span class:hidden={!$userSettings.expandSidebar}>Sign Up</span>
<span>Sign Up</span>
</Button>
<Button
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
@@ -110,7 +117,7 @@
title="Change Instance"
>
<Icon mini src={ServerStack} size="20" />
<span class:hidden={!$userSettings.expandSidebar}>Change instance</span>
<span>Change instance</span>
</Button>
{/if}
</nav>