-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
179 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.