Skip to content

Commit f3f4726

Browse files
authored
Merge pull request #452 from objectstack-ai/copilot/design-demo-effects-for-components
2 parents 8941c7b + c73ee86 commit f3f4726

11 files changed

Lines changed: 1340 additions & 44 deletions

content/docs/blocks/block-schema.mdx

Lines changed: 144 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: "Block Schema (BlockSchema)"
33
description: "Reusable component blocks with variables, slots, and marketplace support"
44
---
55

6+
import { InteractiveDemo, DemoGrid } from '@/app/components/ComponentDemo';
7+
68
# Block Schema
79

810
The `BlockSchema` defines reusable component blocks that can be configured with variables, support content injection through slots, and shared via a marketplace.
@@ -17,6 +19,143 @@ BlockSchema enables:
1719
- **Marketplace support** - Share and discover blocks
1820
- **Version control** - Track block versions
1921

22+
## Interactive Examples
23+
24+
### Feature Card Block
25+
26+
<InteractiveDemo
27+
title="Feature Card Block"
28+
description="A reusable block with configurable icon, title, description, and CTA button"
29+
schema={{
30+
type: "card",
31+
className: "max-w-sm mx-auto",
32+
children: [
33+
{
34+
type: "stack",
35+
spacing: 4,
36+
className: "items-center text-center p-4",
37+
children: [
38+
{
39+
type: "div",
40+
className: "w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center",
41+
children: [{ type: "icon", name: "zap", className: "h-6 w-6 text-primary" }]
42+
},
43+
{ type: "text", content: "Fast Performance", className: "text-lg font-semibold" },
44+
{ type: "text", content: "Lightning-fast response times with optimized bundle sizes and edge caching support.", className: "text-sm text-muted-foreground" },
45+
{ type: "button", label: "Learn More", variant: "outline", size: "sm" }
46+
]
47+
}
48+
]
49+
}}
50+
/>
51+
52+
### Block Variations
53+
54+
<InteractiveDemo
55+
title="Block with Variable Overrides"
56+
description="The same block template rendered with different variable values"
57+
examples={[
58+
{
59+
label: "Security Feature",
60+
schema: {
61+
type: "card",
62+
className: "max-w-sm",
63+
children: [
64+
{
65+
type: "stack",
66+
spacing: 3,
67+
className: "items-center text-center p-4",
68+
children: [
69+
{ type: "div", className: "w-12 h-12 rounded-lg bg-green-500/10 flex items-center justify-center", children: [{ type: "icon", name: "shield", className: "h-6 w-6 text-green-600" }] },
70+
{ type: "text", content: "Enterprise Security", className: "text-lg font-semibold" },
71+
{ type: "text", content: "Bank-grade encryption and SOC 2 compliance built in.", className: "text-sm text-muted-foreground" },
72+
{ type: "button", label: "See Certifications", variant: "outline", size: "sm" }
73+
]
74+
}
75+
]
76+
}
77+
},
78+
{
79+
label: "Analytics Feature",
80+
schema: {
81+
type: "card",
82+
className: "max-w-sm",
83+
children: [
84+
{
85+
type: "stack",
86+
spacing: 3,
87+
className: "items-center text-center p-4",
88+
children: [
89+
{ type: "div", className: "w-12 h-12 rounded-lg bg-purple-500/10 flex items-center justify-center", children: [{ type: "icon", name: "chart-column", className: "h-6 w-6 text-purple-600" }] },
90+
{ type: "text", content: "Advanced Analytics", className: "text-lg font-semibold" },
91+
{ type: "text", content: "Real-time dashboards and custom report builder included.", className: "text-sm text-muted-foreground" },
92+
{ type: "button", label: "View Demo", variant: "outline", size: "sm" }
93+
]
94+
}
95+
]
96+
}
97+
}
98+
]}
99+
/>
100+
101+
### Block Marketplace Card
102+
103+
<InteractiveDemo
104+
title="Block Marketplace Listing"
105+
description="How blocks appear in the marketplace with metadata and ratings"
106+
schema={{
107+
type: "card",
108+
className: "max-w-md mx-auto",
109+
children: [
110+
{
111+
type: "div",
112+
className: "h-32 bg-gradient-to-br from-blue-500/20 to-purple-500/20 rounded-t-lg flex items-center justify-center",
113+
children: [{ type: "icon", name: "layout-template", className: "h-12 w-12 text-primary/60" }]
114+
},
115+
{
116+
type: "stack",
117+
spacing: 3,
118+
className: "p-4",
119+
children: [
120+
{
121+
type: "flex",
122+
className: "items-start justify-between",
123+
children: [
124+
{
125+
type: "stack",
126+
spacing: 1,
127+
children: [
128+
{ type: "text", content: "Pricing Table Pro", className: "font-semibold" },
129+
{ type: "text", content: "by ObjectUI Team", className: "text-xs text-muted-foreground" }
130+
]
131+
},
132+
{ type: "badge", label: "v2.1.0", variant: "secondary" }
133+
]
134+
},
135+
{ type: "text", content: "Professional pricing comparison table with toggle for monthly/yearly billing.", className: "text-sm text-muted-foreground" },
136+
{
137+
type: "flex",
138+
className: "gap-2 flex-wrap",
139+
children: [
140+
{ type: "badge", label: "Marketing", variant: "outline" },
141+
{ type: "badge", label: "SaaS", variant: "outline" },
142+
{ type: "badge", label: "Pricing", variant: "outline" }
143+
]
144+
},
145+
{
146+
type: "flex",
147+
className: "items-center justify-between pt-2 border-t",
148+
children: [
149+
{ type: "text", content: "★ 4.9 (234 ratings) · 5.4k installs", className: "text-xs text-muted-foreground" },
150+
{ type: "button", label: "Install", variant: "default", size: "sm" }
151+
]
152+
}
153+
]
154+
}
155+
]
156+
}}
157+
/>
158+
20159
## Basic Usage
21160

22161
```plaintext
@@ -127,7 +266,7 @@ const cardBlock: BlockSchema = {
127266
label: 'Feature Card',
128267
description: 'A card component for highlighting product features',
129268
category: 'Marketing',
130-
icon: 'Box',
269+
icon: 'box',
131270
tags: ['card', 'feature', 'marketing', 'product'],
132271
author: 'ObjectUI Team',
133272
version: '1.0.0',
@@ -157,9 +296,9 @@ const cardBlock: BlockSchema = {
157296
name: 'icon',
158297
label: 'Icon',
159298
type: 'string',
160-
defaultValue: 'Star',
299+
defaultValue: 'star',
161300
description: 'Lucide icon name',
162-
enum: ['Star', 'Heart', 'Check', 'Zap', 'Shield']
301+
enum: ['star', 'heart', 'check', 'zap', 'shield']
163302
},
164303
{
165304
name: 'variant',
@@ -269,7 +408,7 @@ const instance: BlockInstanceSchema = {
269408
values: {
270409
title: 'Fast Performance',
271410
description: 'Lightning-fast response times',
272-
icon: 'Zap',
411+
icon: 'zap',
273412
variant: 'filled',
274413
showButton: true,
275414
buttonText: 'See Benchmarks'
@@ -364,7 +503,7 @@ const marketplace: BlockLibrarySchema = {
364503
label: 'Pricing Table Pro',
365504
description: 'Professional pricing comparison table',
366505
category: 'Marketing',
367-
icon: 'DollarSign',
506+
icon: 'dollar-sign',
368507
tags: ['pricing', 'saas', 'comparison'],
369508
author: 'ObjectUI Team',
370509
version: '2.1.0',

content/docs/blocks/index.mdx

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: "Building Blocks"
33
description: "Clean, modern building blocks. Copy and paste into your apps. Open Source. Free forever."
44
---
55

6+
import { InteractiveDemo, DemoGrid } from '@/app/components/ComponentDemo';
7+
68
# Building Blocks for the Web
79

810
Pre-built, production-ready UI blocks powered by ObjectUI's schema-driven architecture. Copy the JSON, paste into your application, and ship faster.
@@ -11,6 +13,89 @@ Pre-built, production-ready UI blocks powered by ObjectUI's schema-driven archit
1113

1214
Blocks are complete, ready-to-use UI patterns built with ObjectUI components. Unlike individual components, blocks are composed sections like login forms, pricing tables, dashboard cards, and more—ready to be dropped into your application.
1315

16+
### Quick Preview
17+
18+
<InteractiveDemo
19+
title="Block Gallery"
20+
description="A selection of ready-to-use blocks for rapid development"
21+
examples={[
22+
{
23+
label: "Stats Card",
24+
schema: {
25+
type: "card",
26+
className: "max-w-xs",
27+
children: [
28+
{
29+
type: "stack",
30+
spacing: 2,
31+
className: "p-4",
32+
children: [
33+
{
34+
type: "flex",
35+
className: "items-center justify-between",
36+
children: [
37+
{ type: "text", content: "Total Revenue", className: "text-sm font-medium text-muted-foreground" },
38+
{ type: "icon", name: "dollar-sign", className: "h-4 w-4 text-muted-foreground" }
39+
]
40+
},
41+
{ type: "text", content: "$45,231.89", className: "text-2xl font-bold" },
42+
{ type: "text", content: "+20.1% from last month", className: "text-xs text-muted-foreground" }
43+
]
44+
}
45+
]
46+
}
47+
},
48+
{
49+
label: "Login Card",
50+
schema: {
51+
type: "card",
52+
className: "max-w-sm mx-auto",
53+
header: [
54+
{
55+
type: "stack",
56+
spacing: 1,
57+
className: "text-center",
58+
children: [
59+
{ type: "text", content: "Sign In", className: "text-xl font-bold" },
60+
{ type: "text", content: "Enter your credentials", className: "text-sm text-muted-foreground" }
61+
]
62+
}
63+
],
64+
children: [
65+
{
66+
type: "stack",
67+
spacing: 3,
68+
children: [
69+
{ type: "stack", spacing: 2, children: [{ type: "label", label: "Email" }, { type: "input", inputType: "email", placeholder: "you@example.com" }] },
70+
{ type: "stack", spacing: 2, children: [{ type: "label", label: "Password" }, { type: "input", inputType: "password", placeholder: "••••••••" }] },
71+
{ type: "button", label: "Sign In", variant: "default", className: "w-full" }
72+
]
73+
}
74+
]
75+
}
76+
},
77+
{
78+
label: "Notification Item",
79+
schema: {
80+
type: "flex",
81+
className: "items-start gap-3 p-4 border rounded-lg max-w-md",
82+
children: [
83+
{ type: "avatar", fallback: "JD", className: "h-10 w-10" },
84+
{
85+
type: "stack",
86+
spacing: 1,
87+
children: [
88+
{ type: "text", content: "John Doe commented on your post", className: "text-sm font-medium" },
89+
{ type: "text", content: "Great work on the new design! The color scheme looks amazing.", className: "text-sm text-muted-foreground" },
90+
{ type: "text", content: "2 minutes ago", className: "text-xs text-muted-foreground" }
91+
]
92+
}
93+
]
94+
}
95+
}
96+
]}
97+
/>
98+
1499
### Why Use Blocks?
15100

16101
- 🚀 **Ship Faster** - Start with working examples instead of building from scratch

0 commit comments

Comments
 (0)