diff --git a/apps/website/src/components/landing/HighlightedCode.tsx b/apps/website/src/components/landing/HighlightedCode.tsx new file mode 100644 index 000000000..f1b7d8b44 --- /dev/null +++ b/apps/website/src/components/landing/HighlightedCode.tsx @@ -0,0 +1,21 @@ +import { codeToHtml } from 'shiki'; + +interface HighlightedCodeProps { + code: string; + lang?: string; +} + +export async function HighlightedCode({ code, lang = 'typescript' }: HighlightedCodeProps) { + const html = await codeToHtml(code.trim(), { + lang, + theme: 'tokyo-night', + }); + + return ( +
+ ); +} diff --git a/apps/website/src/components/landing/angular/AngularCodeShowcase.tsx b/apps/website/src/components/landing/angular/AngularCodeShowcase.tsx index 01880d836..4f15233df 100644 --- a/apps/website/src/components/landing/angular/AngularCodeShowcase.tsx +++ b/apps/website/src/components/landing/angular/AngularCodeShowcase.tsx @@ -1,7 +1,5 @@ -// apps/website/src/components/landing/angular/AngularCodeShowcase.tsx -'use client'; -import { motion } from 'framer-motion'; import { tokens } from '@cacheplane/design-tokens'; +import { HighlightedCode } from '../HighlightedCode'; const SNIPPET_1 = `import { agent } from '@cacheplane/angular'; @@ -27,16 +25,15 @@ provideAgent({ : new FetchStreamTransport(), });`; -export function AngularCodeShowcase() { +const SNIPPETS = [ + { title: 'Minimal Setup', code: SNIPPET_1, lang: 'typescript' }, + { title: 'Full Configuration', code: SNIPPET_2, lang: 'typescript' }, +]; + +export async function AngularCodeShowcase() { return (
- +

Production streaming in a few lines - +

- {[{ title: 'Minimal Setup', code: SNIPPET_1 }, { title: 'Full Configuration', code: SNIPPET_2 }].map((s, i) => ( - ( +
-
-              {s.code}
-            
- + +
))}
diff --git a/apps/website/src/components/landing/chat-landing/ChatLandingCodeShowcase.tsx b/apps/website/src/components/landing/chat-landing/ChatLandingCodeShowcase.tsx index f84aad841..3a07dcb18 100644 --- a/apps/website/src/components/landing/chat-landing/ChatLandingCodeShowcase.tsx +++ b/apps/website/src/components/landing/chat-landing/ChatLandingCodeShowcase.tsx @@ -1,7 +1,5 @@ -// apps/website/src/components/landing/chat-landing/ChatLandingCodeShowcase.tsx -'use client'; -import { motion } from 'framer-motion'; import { tokens } from '@cacheplane/design-tokens'; +import { HighlightedCode } from '../HighlightedCode'; const SNIPPET_1 = `import { ChatComponent } from '@cacheplane/chat'; @@ -28,16 +26,15 @@ const SNIPPET_2 = `chat { --chat-input-border: 1px solid #e4e4e7; }`; -export function ChatLandingCodeShowcase() { +const SNIPPETS = [ + { title: 'Prebuilt Chat', code: SNIPPET_1, lang: 'typescript' }, + { title: 'Custom Theming', code: SNIPPET_2, lang: 'css' }, +]; + +export async function ChatLandingCodeShowcase() { return (
- +

Full-featured chat in a few lines - +

- {[{ title: 'Prebuilt Chat', code: SNIPPET_1 }, { title: 'Custom Theming', code: SNIPPET_2 }].map((s, i) => ( - ( +
-
-              {s.code}
-            
- + +
))}
diff --git a/apps/website/src/components/landing/render/RenderCodeShowcase.tsx b/apps/website/src/components/landing/render/RenderCodeShowcase.tsx index bde5c9dbe..335c0c72d 100644 --- a/apps/website/src/components/landing/render/RenderCodeShowcase.tsx +++ b/apps/website/src/components/landing/render/RenderCodeShowcase.tsx @@ -1,7 +1,5 @@ -// apps/website/src/components/landing/render/RenderCodeShowcase.tsx -'use client'; -import { motion } from 'framer-motion'; import { tokens } from '@cacheplane/design-tokens'; +import { HighlightedCode } from '../HighlightedCode'; const SNIPPET_1 = `import { defineAngularRegistry } from '@cacheplane/render'; import { TableComponent } from './table.component'; @@ -19,16 +17,15 @@ const SNIPPET_2 = ``; -export function RenderCodeShowcase() { +const SNIPPETS = [ + { title: 'Registry Setup', code: SNIPPET_1, lang: 'typescript' }, + { title: 'Template Binding', code: SNIPPET_2, lang: 'html' }, +]; + +export async function RenderCodeShowcase() { return (
- +

Generative UI in a few lines - +

- {[{ title: 'Registry Setup', code: SNIPPET_1 }, { title: 'Template Binding', code: SNIPPET_2 }].map((s, i) => ( - ( +
-
-              {s.code}
-            
- + +
))}