-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcode-preview.tsx
More file actions
90 lines (85 loc) · 4.39 KB
/
Copy pathcode-preview.tsx
File metadata and controls
90 lines (85 loc) · 4.39 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
import { cn } from '@/lib/utils';
interface CodePreviewProps {
className?: string;
}
export function CodePreview({ className }: CodePreviewProps) {
const kw = 'text-purple-600 dark:text-purple-400 font-semibold';
const str = 'text-green-600 dark:text-green-300';
const fn = 'text-blue-600 dark:text-blue-300';
const typ = 'text-amber-600 dark:text-yellow-300';
const prop = 'text-cyan-600 dark:text-sky-300';
const bool = 'text-red-600 dark:text-red-300';
const fg = 'text-foreground';
const cm = 'text-foreground/40 italic';
return (
<div className={cn(
"relative mx-auto mt-12 w-full max-w-3xl transform rounded-xl bg-gradient-to-br from-border/50 to-border/10 p-[2px] opacity-90 transition-all hover:scale-[1.01] hover:opacity-100 sm:mt-16",
className
)}>
<div className="overflow-hidden rounded-xl border border-border bg-card shadow-2xl">
{/* Window Controls */}
<div className="flex items-center gap-2 border-b border-border bg-muted/50 px-4 py-3">
<div className="h-3 w-3 rounded-full bg-red-500/80" />
<div className="h-3 w-3 rounded-full bg-yellow-500/80" />
<div className="h-3 w-3 rounded-full bg-green-500/80" />
<div className="ml-2 text-xs font-medium text-muted-foreground font-mono">
src/objects/task.object.ts
</div>
</div>
{/* Code Content — real ObjectStack API */}
<div className="overflow-x-auto p-6 text-left bg-gradient-to-br from-card to-muted/20">
<pre className="font-mono text-sm leading-7">
<code>
<span className={kw}>import</span>{' '}
<span className={fg}>{'{'}</span>{' '}
<span className={typ}>Data</span>{' '}
<span className={fg}>{'}'}</span>{' '}
<span className={kw}>from</span>{' '}
<span className={str}>'@objectstack/spec'</span>;
<br/><br/>
<span className={kw}>const</span>{' '}
<span className={fn}>task</span>:{' '}
<span className={typ}>Data.Object</span>{' '}
<span className={fg}>=</span>{' '}
<span className={fg}>{'{'}</span>
<br/>
{' '}<span className={prop}>name</span>:{' '}<span className={str}>'task'</span>,
<br/>
{' '}<span className={prop}>label</span>:{' '}<span className={str}>'Task'</span>,
<br/>
{' '}<span className={prop}>fields</span>:{' '}<span className={fg}>{'{'}</span>
<br/>
{' '}<span className={prop}>subject</span>:{' '}<span className={fg}>{'{'}</span>{' '}
<span className={prop}>type</span>:{' '}<span className={str}>'text'</span>,{' '}
<span className={prop}>required</span>:{' '}<span className={bool}>true</span>{' '}
<span className={fg}>{'}'}</span>,
<br/>
{' '}<span className={prop}>status</span>:{' '}<span className={fg}>{'{'}</span>
<br/>
{' '}<span className={prop}>type</span>:{' '}<span className={str}>'select'</span>,
<br/>
{' '}<span className={prop}>options</span>:{' '}[<span className={str}>'draft'</span>, <span className={str}>'active'</span>, <span className={str}>'done'</span>],
<br/>
{' '}<span className={fg}>{'}'}</span>,
<br/>
{' '}<span className={prop}>assignee</span>:{' '}<span className={fg}>{'{'}</span>{' '}
<span className={prop}>type</span>:{' '}<span className={str}>'lookup'</span>,{' '}
<span className={prop}>reference</span>:{' '}<span className={str}>'user'</span>{' '}
<span className={fg}>{'}'}</span>,
<br/>
{' '}<span className={fg}>{'}'}</span>,
<br/>
<span className={fg}>{'}'}</span>;
<br/><br/>
<span className={cm}>{'// → REST API at /api/v1/task'}</span>
<br/>
<span className={cm}>{'// → Console UI at /_studio/'}</span>
</code>
</pre>
</div>
</div>
{/* Glow Effect */}
<div className="absolute -inset-4 -z-10 bg-primary/20 blur-3xl opacity-30 rounded-[50%]" />
</div>
);
}