-
Notifications
You must be signed in to change notification settings - Fork 742
Expand file tree
/
Copy pathPartialsSection.tsx
More file actions
92 lines (88 loc) · 2.96 KB
/
PartialsSection.tsx
File metadata and controls
92 lines (88 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { CodeBlock } from "../../components/CodeBlock.tsx";
import { CodeWindow } from "../../components/CodeWindow.tsx";
import { PageSection } from "../../components/PageSection.tsx";
import { SideBySide } from "../../components/SideBySide.tsx";
import { SectionHeading } from "../../components/homepage/SectionHeading.tsx";
import { DemoBox } from "../../components/homepage/DemoBox.tsx";
import { ExampleArrow } from "../../components/homepage/ExampleArrow.tsx";
import { RecipeDemo } from "../../components/homepage/RecipeDemo.tsx";
import { FancyLink } from "../../components/FancyLink.tsx";
const islandCode = `import { Partial } from "fresh/runtime";
export const Recipes = () => (
<div f-client-nav>
<aside>
<button f-partial="/recipes/lemonade">
Lemonade
</button>
<button f-partial="/recipes/lemon-honey-tea">
Lemon-honey tea
</button>
<button f-partial="/recipes/lemondrop">
Lemondrop Martini
</button>
</aside>
<main>
<Partial name="recipe">
Click a recipe to stream HTML into this spot
</Partial>
</main>
</div>
);`;
export function PartialsSection() {
return (
<PageSection>
<SideBySide
mdColSplit="3/2"
lgColSplit="3/2"
reverseOnDesktop
class="!items-start"
>
<div class="flex flex-col gap-4 md:sticky md:top-4">
<svg
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrows-transfer-down text-fresh"
width="4rem"
height="4rem"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<title>Arrows transferring data down</title>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M17 3v6" />
<path d="M10 18l-3 3l-3 -3" />
<path d="M7 21v-18" />
<path d="M20 6l-3 -3l-3 3" />
<path d="M17 21v-2" />
<path d="M17 15v-2" />
</svg>
<SectionHeading>Stream HTML straight from the server</SectionHeading>
<p>
Fresh Partials let you fetch HTML and slot it directly into the
page, without a full page reload—perfect for interactive elements
and dynamic apps.
</p>
<FancyLink href="/docs/advanced/partials" class="mt-4">
Learn more about Partials
</FancyLink>
</div>
<div class="flex flex-col gap-4">
<CodeWindow name="components/Recipes.tsx">
<CodeBlock
code={islandCode}
lang="jsx"
/>
</CodeWindow>
<ExampleArrow class="[transform:rotateY(-180deg)]" />
<DemoBox flip>
<RecipeDemo />
</DemoBox>
</div>
</SideBySide>
</PageSection>
);
}