Skip to content

Commit 2ebb406

Browse files
📝 docs: refine home hero and drop api section
1 parent 8f1b548 commit 2ebb406

6 files changed

Lines changed: 199 additions & 164 deletions

File tree

‎docs/home/ApiSection.tsx‎

Lines changed: 0 additions & 46 deletions
This file was deleted.

‎docs/home/HeroDemo.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const HeroDemo = () => {
2323
<StreamPane
2424
latexGuard
2525
content={text}
26-
height={300}
26+
height={600}
2727
rehypePlugins={rehypePlugins}
2828
remarkPlugins={remarkPlugins}
2929
title={"heroSample.md"}

‎docs/home/home.tsx‎

Lines changed: 59 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
1-
import { Flexbox, Snippet, Text } from "@lobehub/ui";
2-
import { LandingHero, LandingSection } from "@lobehub/ui/awesome";
1+
import {
2+
ClaudeCode,
3+
Codex,
4+
Cursor,
5+
GithubCopilot,
6+
Windsurf,
7+
} from "@lobehub/icons";
8+
import { Flexbox, Text } from "@lobehub/ui";
9+
import {
10+
AgentSkillCard,
11+
LandingHero,
12+
LandingSection,
13+
} from "@lobehub/ui/awesome";
14+
import { GithubIcon } from "@lobehub/ui/icons";
315
import { ArrowRight } from "lucide-react";
4-
import { useCallback } from "react";
516
import { useNavigate } from "react-router";
617

718
import Playground from "../../src/Streamdown/demos/Playground";
8-
import { ApiSection } from "./ApiSection";
919
import { Features } from "./Features";
1020
import { HeroDemo } from "./HeroDemo";
1121
import { renderLink } from "./renderLink";
1222

23+
const SITE_URL = "https://streamdown.lobehub.com";
1324
const REPO = "https://github.com/lobehub/streamdown";
1425
const NPM = "https://www.npmjs.com/package/@lobehub/streamdown";
15-
const INSTALL_COMMAND = "pnpm add @lobehub/streamdown";
1626

17-
// Mirrors the original Vite site (f3ba7b3:site/src/App.tsx): Hero → Features → Playground → API.
27+
const AGENTS = [
28+
{ avatar: ClaudeCode.Avatar, title: "Claude Code" },
29+
{ avatar: Codex.Avatar, title: "Codex" },
30+
{ avatar: Cursor.Avatar, title: "Cursor" },
31+
{ avatar: GithubCopilot.Avatar, title: "GitHub Copilot" },
32+
{ avatar: Windsurf.Avatar, title: "Windsurf" },
33+
];
34+
35+
// Standard landing hero (building-landing-home) with the original hero stream below it, then the
36+
// original Vite site's sections (f3ba7b3:site/src/App.tsx): Features → Playground → footer.
1837
export default function Home({ description }: { description: string }) {
1938
const navigate = useNavigate();
20-
// In-page anchors (#playground, #api) scroll; everything else goes through the router.
21-
const onNavigate = useCallback(
22-
(href: string) => {
23-
if (href.startsWith("#")) {
24-
document
25-
.getElementById(href.slice(1))
26-
?.scrollIntoView({ behavior: "smooth" });
27-
return;
28-
}
29-
navigate(href);
30-
},
31-
[navigate],
32-
);
3339

3440
return (
3541
<>
36-
<span hidden data-pagefind-meta={`description:${description}`} />
3742
<LandingHero
38-
accent={"as it arrives"}
43+
accent={"Streaming Markdown"}
3944
renderLink={renderLink}
45+
title={<span data-pagefind-meta="title">Streamdown</span>}
4046
actions={[
4147
{
4248
href: "/guide/getting-started",
@@ -45,26 +51,42 @@ export default function Home({ description }: { description: string }) {
4551
label: "Get Started",
4652
primary: true,
4753
},
48-
{ href: "#playground", label: "Try the playground" },
54+
{ href: REPO, icon: GithubIcon, label: "GitHub" },
4955
]}
50-
badge={
51-
<span>
52-
<b>New</b> Block-level caching, 2× less main-thread time
53-
</span>
56+
aside={
57+
<AgentSkillCard
58+
agents={AGENTS}
59+
agent={{
60+
code: `Read ${SITE_URL}/skills.md and follow it to render streaming LLM markdown with @lobehub/streamdown.`,
61+
description:
62+
"Send this prompt to your agent to wire up Streamdown",
63+
}}
64+
footer={
65+
<>
66+
<a href={"/skills.md"} rel={"noreferrer"} target={"_blank"}>
67+
skills.md
68+
</a>
69+
<a href={"/llms.txt"} rel={"noreferrer"} target={"_blank"}>
70+
llms.txt
71+
</a>
72+
</>
73+
}
74+
human={{
75+
code: "pnpm add @lobehub/streamdown",
76+
description: "Install Streamdown into your React project",
77+
}}
78+
/>
5479
}
5580
description={
56-
"A headless streaming markdown engine for React. Per-character reveal, block-level caching, and a LaTeX guard that keeps half-typed math from breaking mid-stream. Ships zero styles."
81+
<span data-pagefind-meta="description">{description}</span>
5782
}
58-
title={
59-
<span data-pagefind-meta="title:Streamdown">Render markdown</span>
60-
}
61-
onNavigate={onNavigate}
62-
>
63-
<Flexbox align={"center"} gap={32} width={"100%"}>
64-
<Snippet language={"sh"}>{INSTALL_COMMAND}</Snippet>
65-
<HeroDemo />
66-
</Flexbox>
67-
</LandingHero>
83+
onNavigate={navigate}
84+
/>
85+
86+
{/* Outside LandingHero so body text is not centered by the hero's textAlign. */}
87+
<div style={{ marginBlock: 8, textAlign: "left", width: "100%" }}>
88+
<HeroDemo />
89+
</div>
6890

6991
<LandingSection id={"home-features"}>
7092
<Features />
@@ -87,21 +109,6 @@ export default function Home({ description }: { description: string }) {
87109
</LandingSection>
88110
</div>
89111

90-
<div id={"api"}>
91-
<LandingSection
92-
id={"home-api"}
93-
title={"API"}
94-
description={
95-
<>
96-
Props on the <code>&lt;Streamdown /&gt;</code> component, rendered
97-
by Streamdown itself.
98-
</>
99-
}
100-
>
101-
<ApiSection />
102-
</LandingSection>
103-
</div>
104-
105112
<Flexbox
106113
horizontal
107114
align={"center"}

‎src/Streamdown/demos/Playground.tsx‎

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
StreamdownProfilerProvider,
1111
} from "@lobehub/streamdown/profiler";
1212
import { Flexbox } from "@lobehub/ui";
13+
import { Surface } from "@lobehub/ui/dashboard";
1314
import { StoryBook, useControls, useCreateStore } from "@lobehub/ui/storybook";
1415
import { useEffect, useMemo } from "react";
1516
import rehypeKatex from "rehype-katex";
@@ -137,28 +138,30 @@ export default () => {
137138
]);
138139

139140
return (
140-
<StoryBook levaStore={store}>
141-
<Flexbox gap={12} padding={4} width={"100%"}>
142-
<StreamdownProfilerProvider profiler={profiler}>
143-
<StreamPane
144-
content={text}
145-
extra={<ProfilerRate profiler={profiler} />}
146-
granularity={granularity}
147-
height={420}
148-
latexGuard={latexGuard}
149-
preprocess={preprocess ? preprocessLaTeX : undefined}
150-
rehypePlugins={rehypePlugins}
151-
remarkPlugins={remarkPlugins}
152-
smoothing={smoothing}
153-
title={samples[sampleKey].label}
154-
onReplay={() => {
155-
profiler.reset("playground");
156-
restart();
157-
}}
158-
/>
159-
</StreamdownProfilerProvider>
160-
<ProfilerPanel profiler={profiler} />
161-
</Flexbox>
162-
</StoryBook>
141+
<Surface style={{ overflow: "hidden", width: "100%" }}>
142+
<StoryBook levaStore={store}>
143+
<Flexbox gap={12} padding={4} width={"100%"}>
144+
<StreamdownProfilerProvider profiler={profiler}>
145+
<StreamPane
146+
content={text}
147+
extra={<ProfilerRate profiler={profiler} />}
148+
granularity={granularity}
149+
height={420}
150+
latexGuard={latexGuard}
151+
preprocess={preprocess ? preprocessLaTeX : undefined}
152+
rehypePlugins={rehypePlugins}
153+
remarkPlugins={remarkPlugins}
154+
smoothing={smoothing}
155+
title={samples[sampleKey].label}
156+
onReplay={() => {
157+
profiler.reset("playground");
158+
restart();
159+
}}
160+
/>
161+
</StreamdownProfilerProvider>
162+
<ProfilerPanel profiler={profiler} />
163+
</Flexbox>
164+
</StoryBook>
165+
</Surface>
163166
);
164167
};

‎src/Streamdown/demos/shared/StreamPane.tsx‎

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Streamdown, type StreamdownProps } from "@lobehub/streamdown";
2-
import { Block, Button, Flexbox, Icon, Text, Typography } from "@lobehub/ui";
2+
import { Button, Flexbox, Icon, Typography } from "@lobehub/ui";
3+
import { Surface } from "@lobehub/ui/dashboard";
34
import { RotateCcw } from "lucide-react";
45
import { type ReactNode } from "react";
56

@@ -15,7 +16,7 @@ export interface StreamPaneProps extends StreamdownProps {
1516
title?: ReactNode;
1617
}
1718

18-
/** A framed, auto-scrolling `<Streamdown />` output with a header and a replay button. */
19+
/** An auto-scrolling `<Streamdown />` output on a Lobe UI `Surface`, with a header and a replay button. */
1920
export const StreamPane = ({
2021
extra,
2122
height = 320,
@@ -26,18 +27,11 @@ export const StreamPane = ({
2627
const { onScroll, ref } = useStickToBottom();
2728

2829
return (
29-
<Block style={{ overflow: "hidden" }} variant={"outlined"} width={"100%"}>
30-
<Flexbox
31-
horizontal
32-
align={"center"}
33-
gap={8}
34-
justify={"space-between"}
35-
paddingBlock={8}
36-
paddingInline={12}
37-
>
38-
<Text fontSize={12} type={"secondary"}>
39-
{title}
40-
</Text>
30+
<Surface
31+
padded={false}
32+
style={{ width: "100%" }}
33+
title={title}
34+
extra={
4135
<Flexbox horizontal align={"center"} gap={8}>
4236
{extra}
4337
{onReplay && (
@@ -50,7 +44,8 @@ export const StreamPane = ({
5044
</Button>
5145
)}
5246
</Flexbox>
53-
</Flexbox>
47+
}
48+
>
5449
<div
5550
ref={ref}
5651
style={{
@@ -65,6 +60,6 @@ export const StreamPane = ({
6560
<Streamdown components={markdownComponents} {...streamdownProps} />
6661
</Typography>
6762
</div>
68-
</Block>
63+
</Surface>
6964
);
7065
};

0 commit comments

Comments
 (0)