Skip to content

Commit

Permalink
refactor: use render children() instead of slot
Browse files Browse the repository at this point in the history
  • Loading branch information
braden-w committed Dec 17, 2024
1 parent 5e39808 commit d0b1dc8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apps/app/src/routes/(config)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import NavItems from '$lib/components/NavItems.svelte';
import WhisperingButton from '$lib/components/WhisperingButton.svelte';
import { recorder } from '$lib/stores/recorder.svelte';
import { cn } from '$lib/utils.js';
let { children } = $props();
</script>

<header
Expand Down Expand Up @@ -35,4 +37,4 @@ import { cn } from '$lib/utils.js';
<NavItems class="-mr-4" />
</header>

<slot />
{@render children()}
4 changes: 3 additions & 1 deletion apps/app/src/routes/(config)/settings/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Button } from '$lib/components/ui/button/index.js';
import { Separator } from '$lib/components/ui/separator/index.js';
import SidebarNav from './SidebarNav.svelte';
let { children } = $props();
const sidebarNavItems = [
{ title: 'General', href: '/settings' },
{ title: 'Recording', href: '/settings/recording' },
Expand Down Expand Up @@ -71,7 +73,7 @@ const versionPromise = (async () => {
<SidebarNav items={sidebarNavItems} />
</aside>
<div class="flex-1 lg:max-w-2xl">
<slot />
{@render children()}
</div>
</div>
</main>
4 changes: 3 additions & 1 deletion apps/app/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import type { ToasterProps } from 'svelte-sonner';
import { Toaster } from 'svelte-sonner';
import '../app.css';
let { children } = $props();
onNavigate((navigation) => {
if (!document.startViewTransition) return;
Expand Down Expand Up @@ -71,7 +73,7 @@ const TOASTER_SETTINGS = {
</button>

<div class="xxs:flex hidden min-h-screen flex-col items-center gap-2">
<slot />
{@render children()}
</div>

<Toaster class="xs:block hidden" theme={$mode} {...TOASTER_SETTINGS} />
Expand Down

0 comments on commit d0b1dc8

Please sign in to comment.