Skip to content

Commit 29da61e

Browse files
author
Jesse Winton
authored
Merge branch 'main' into blog-cloud-latency
2 parents abc39c5 + 5634e50 commit 29da61e

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

src/lib/components/Feedback.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,14 @@
129129
<div class="flex flex-col gap-2">
130130
<label for="message">
131131
<span class="text-primary">
132-
What did you {feedbackType === 'negative' ? 'dislike' : 'like'}? (optional)
132+
What did you {feedbackType === 'negative' ? 'dislike' : 'like'}?
133133
</span>
134134
</label>
135135
<textarea
136136
class="web-input-text"
137137
id="message"
138138
placeholder="Write your message"
139+
required
139140
bind:value={comment}
140141
></textarea>
141142
<label for="message" class="mt-2">

src/lib/layouts/Docs.svelte

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script lang="ts" context="module">
1+
<script lang="ts" module>
22
import { navigating } from '$app/stores';
33
import { writable } from 'svelte/store';
44
@@ -40,6 +40,8 @@
4040
</script>
4141

4242
<script lang="ts">
43+
import { run } from 'svelte/legacy';
44+
4345
import { Search, IsLoggedIn } from '$lib/components';
4446
import { isMac } from '$lib/utils/platform';
4547
import { getContext, setContext } from 'svelte';
@@ -48,17 +50,25 @@
4850
import { getAppwriteDashboardUrl } from '$lib/utils/dashboard';
4951
import { Button, Icon, InlineTag } from '$lib/components/ui';
5052
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();
5360
5461
const variantClasses: Record<DocsLayoutVariant, string> = {
5562
default: 'web-grid-side-nav max-w-[90rem] mx-auto',
5663
expanded: 'web-grid-huge-navs',
5764
'two-side-navs': 'web-grid-two-side-navs'
5865
};
5966
60-
$: variantClass = variantClasses[variant];
61-
$: $layoutState.currentVariant = variant;
67+
let variantClass = $derived(variantClasses[variant]);
68+
69+
$effect(() => {
70+
$layoutState.currentVariant = variant;
71+
});
6272
6373
navigating.subscribe(() => {
6474
layoutState.update((n) => ({
@@ -83,9 +93,9 @@
8393
};
8494
</script>
8595

86-
<svelte:window on:keydown={handleKeydown} />
96+
<svelte:window onkeydown={handleKeydown} />
8797

88-
<div class="relative">
98+
<div class="relative" data-variant={$layoutState.currentVariant}>
8999
<section class="web-mobile-header is-transparent">
90100
<div class="web-mobile-header-start">
91101
<a href="/" aria-label="homepage">
@@ -150,7 +160,7 @@
150160
<div class="web-u-margin-inline-start-48 flex flex-1">
151161
<button
152162
class="web-input-button web-u-flex-basis-400"
153-
on:click={() => ($layoutState.showSearch = true)}
163+
onclick={() => ($layoutState.showSearch = true)}
154164
>
155165
<span class="web-icon-search" aria-hidden="true"></span>
156166
<span class="text">Search in docs</span>
@@ -188,7 +198,7 @@
188198
class:is-open={$layoutState.showSidenav}
189199
style:--container-size={variant === 'default' ? 'var(--container-size-large)' : undefined}
190200
>
191-
<slot />
201+
{@render children?.()}
192202
</div>
193203
</div>
194204

src/routes/docs/tutorials/+layout.svelte

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
import { page } from '$app/state';
33
import Docs, { type DocsLayoutVariant } from '$lib/layouts/Docs.svelte';
44
import Sidebar from '../Sidebar.svelte';
5+
interface Props {
6+
children?: import('svelte').Snippet;
7+
}
58
6-
$: variant =
7-
page.route.id === '/docs/tutorials' ? 'default' : ('two-side-navs' as DocsLayoutVariant);
9+
let { children }: Props = $props();
10+
11+
let variant = $derived(
12+
page.route.id === '/docs/tutorials' ? 'default' : ('two-side-navs' as DocsLayoutVariant)
13+
);
814
</script>
915

1016
<Docs {variant}>
1117
<Sidebar />
12-
<slot />
18+
{@render children?.()}
1319
</Docs>

0 commit comments

Comments
 (0)