Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apps/website/src/components/landing/HighlightedCode.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div
className="shiki"
style={{ margin: 0, borderRadius: 0 }}
dangerouslySetInnerHTML={{ __html: html }}
/>
);
}
39 changes: 13 additions & 26 deletions apps/website/src/components/landing/angular/AngularCodeShowcase.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 (
<section style={{ padding: '80px 32px' }}>
<motion.div
initial={{ opacity: 0, y: 16 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.5 }}
style={{ textAlign: 'center', marginBottom: 48 }}
>
<div style={{ textAlign: 'center', marginBottom: 48 }}>
<p style={{
fontFamily: 'var(--font-mono,"JetBrains Mono",monospace)',
fontSize: '0.7rem', textTransform: 'uppercase', letterSpacing: '0.12em',
Expand All @@ -51,19 +48,15 @@ export function AngularCodeShowcase() {
}}>
Production streaming in a few lines
</h2>
</motion.div>
</div>

<div style={{
maxWidth: 900, margin: '0 auto',
display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(380px, 100%), 1fr))', gap: 24,
}}>
{[{ title: 'Minimal Setup', code: SNIPPET_1 }, { title: 'Full Configuration', code: SNIPPET_2 }].map((s, i) => (
<motion.div
{SNIPPETS.map((s) => (
<div
key={s.title}
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.45, delay: i * 0.1 }}
style={{ borderRadius: 14, overflow: 'hidden', border: `1px solid ${tokens.glass.border}` }}
>
<div style={{
Expand All @@ -77,14 +70,8 @@ export function AngularCodeShowcase() {
{s.title}
</span>
</div>
<pre style={{
background: '#1a1b26', color: '#c8ccee', padding: '20px 24px',
fontSize: '0.78rem', lineHeight: 1.65, margin: 0, overflowX: 'auto',
fontFamily: "'JetBrains Mono', monospace",
}}>
<code>{s.code}</code>
</pre>
</motion.div>
<HighlightedCode code={s.code} lang={s.lang} />
</div>
))}
</div>
</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 (
<section style={{ padding: '80px 32px' }}>
<motion.div
initial={{ opacity: 0, y: 16 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.5 }}
style={{ textAlign: 'center', marginBottom: 48 }}
>
<div style={{ textAlign: 'center', marginBottom: 48 }}>
<p style={{
fontFamily: 'var(--font-mono,"JetBrains Mono",monospace)',
fontSize: '0.7rem', textTransform: 'uppercase', letterSpacing: '0.12em',
Expand All @@ -52,19 +49,15 @@ export function ChatLandingCodeShowcase() {
}}>
Full-featured chat in a few lines
</h2>
</motion.div>
</div>

<div style={{
maxWidth: 900, margin: '0 auto',
display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(380px, 100%), 1fr))', gap: 24,
}}>
{[{ title: 'Prebuilt Chat', code: SNIPPET_1 }, { title: 'Custom Theming', code: SNIPPET_2 }].map((s, i) => (
<motion.div
{SNIPPETS.map((s) => (
<div
key={s.title}
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.45, delay: i * 0.1 }}
style={{ borderRadius: 14, overflow: 'hidden', border: `1px solid ${tokens.glass.border}` }}
>
<div style={{
Expand All @@ -78,14 +71,8 @@ export function ChatLandingCodeShowcase() {
{s.title}
</span>
</div>
<pre style={{
background: '#1a1b26', color: '#c8ccee', padding: '20px 24px',
fontSize: '0.78rem', lineHeight: 1.65, margin: 0, overflowX: 'auto',
fontFamily: "'JetBrains Mono', monospace",
}}>
<code>{s.code}</code>
</pre>
</motion.div>
<HighlightedCode code={s.code} lang={s.lang} />
</div>
))}
</div>
</section>
Expand Down
39 changes: 13 additions & 26 deletions apps/website/src/components/landing/render/RenderCodeShowcase.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -19,16 +17,15 @@ const SNIPPET_2 = `<render-spec
[state]="stateStore"
/>`;

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 (
<section style={{ padding: '80px 32px' }}>
<motion.div
initial={{ opacity: 0, y: 16 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.5 }}
style={{ textAlign: 'center', marginBottom: 48 }}
>
<div style={{ textAlign: 'center', marginBottom: 48 }}>
<p style={{
fontFamily: 'var(--font-mono,"JetBrains Mono",monospace)',
fontSize: '0.7rem', textTransform: 'uppercase', letterSpacing: '0.12em',
Expand All @@ -43,19 +40,15 @@ export function RenderCodeShowcase() {
}}>
Generative UI in a few lines
</h2>
</motion.div>
</div>

<div style={{
maxWidth: 900, margin: '0 auto',
display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(380px, 100%), 1fr))', gap: 24,
}}>
{[{ title: 'Registry Setup', code: SNIPPET_1 }, { title: 'Template Binding', code: SNIPPET_2 }].map((s, i) => (
<motion.div
{SNIPPETS.map((s) => (
<div
key={s.title}
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.45, delay: i * 0.1 }}
style={{ borderRadius: 14, overflow: 'hidden', border: `1px solid ${tokens.glass.border}` }}
>
<div style={{
Expand All @@ -69,14 +62,8 @@ export function RenderCodeShowcase() {
{s.title}
</span>
</div>
<pre style={{
background: '#1a1b26', color: '#c8ccee', padding: '20px 24px',
fontSize: '0.78rem', lineHeight: 1.65, margin: 0, overflowX: 'auto',
fontFamily: "'JetBrains Mono', monospace",
}}>
<code>{s.code}</code>
</pre>
</motion.div>
<HighlightedCode code={s.code} lang={s.lang} />
</div>
))}
</div>
</section>
Expand Down
Loading