|
1 |
| -<script lang="ts" context="module"> |
| 1 | +<script lang="ts" module> |
2 | 2 | import { navigating } from '$app/stores';
|
3 | 3 | import { writable } from 'svelte/store';
|
4 | 4 |
|
|
40 | 40 | </script>
|
41 | 41 |
|
42 | 42 | <script lang="ts">
|
| 43 | + import { run } from 'svelte/legacy'; |
| 44 | +
|
43 | 45 | import { Search, IsLoggedIn } from '$lib/components';
|
44 | 46 | import { isMac } from '$lib/utils/platform';
|
45 | 47 | import { getContext, setContext } from 'svelte';
|
|
48 | 50 | import { getAppwriteDashboardUrl } from '$lib/utils/dashboard';
|
49 | 51 | import { Button, Icon, InlineTag } from '$lib/components/ui';
|
50 | 52 |
|
51 |
| - export let variant: DocsLayoutVariant = 'default'; |
52 |
| - export let isReferences = false; |
| 53 | + interface Props { |
| 54 | + variant?: DocsLayoutVariant; |
| 55 | + isReferences?: boolean; |
| 56 | + children?: import('svelte').Snippet; |
| 57 | + } |
| 58 | +
|
| 59 | + let { variant = 'default', isReferences = false, children }: Props = $props(); |
53 | 60 |
|
54 | 61 | const variantClasses: Record<DocsLayoutVariant, string> = {
|
55 | 62 | default: 'web-grid-side-nav max-w-[90rem] mx-auto',
|
56 | 63 | expanded: 'web-grid-huge-navs',
|
57 | 64 | 'two-side-navs': 'web-grid-two-side-navs'
|
58 | 65 | };
|
59 | 66 |
|
60 |
| - $: variantClass = variantClasses[variant]; |
61 |
| - $: $layoutState.currentVariant = variant; |
| 67 | + let variantClass = $derived(variantClasses[variant]); |
| 68 | +
|
| 69 | + $effect(() => { |
| 70 | + $layoutState.currentVariant = variant; |
| 71 | + }); |
62 | 72 |
|
63 | 73 | navigating.subscribe(() => {
|
64 | 74 | layoutState.update((n) => ({
|
|
83 | 93 | };
|
84 | 94 | </script>
|
85 | 95 |
|
86 |
| -<svelte:window on:keydown={handleKeydown} /> |
| 96 | +<svelte:window onkeydown={handleKeydown} /> |
87 | 97 |
|
88 |
| -<div class="relative"> |
| 98 | +<div class="relative" data-variant={$layoutState.currentVariant}> |
89 | 99 | <section class="web-mobile-header is-transparent">
|
90 | 100 | <div class="web-mobile-header-start">
|
91 | 101 | <a href="/" aria-label="homepage">
|
|
150 | 160 | <div class="web-u-margin-inline-start-48 flex flex-1">
|
151 | 161 | <button
|
152 | 162 | class="web-input-button web-u-flex-basis-400"
|
153 |
| - on:click={() => ($layoutState.showSearch = true)} |
| 163 | + onclick={() => ($layoutState.showSearch = true)} |
154 | 164 | >
|
155 | 165 | <span class="web-icon-search" aria-hidden="true"></span>
|
156 | 166 | <span class="text">Search in docs</span>
|
|
188 | 198 | class:is-open={$layoutState.showSidenav}
|
189 | 199 | style:--container-size={variant === 'default' ? 'var(--container-size-large)' : undefined}
|
190 | 200 | >
|
191 |
| - <slot /> |
| 201 | + {@render children?.()} |
192 | 202 | </div>
|
193 | 203 | </div>
|
194 | 204 |
|
|
0 commit comments