examples.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. import type { Spec } from "@json-render/core";
  2. export interface Example {
  3. name: string;
  4. label: string;
  5. description: string;
  6. spec: Spec;
  7. }
  8. export const examples: Example[] = [
  9. // ==========================================================================
  10. // OG Image
  11. // ==========================================================================
  12. {
  13. name: "og-image",
  14. label: "OG Image",
  15. description: "Social sharing card for Open Graph (1200x630)",
  16. spec: {
  17. root: "frame",
  18. elements: {
  19. frame: {
  20. type: "Frame",
  21. props: {
  22. width: 1200,
  23. height: 630,
  24. backgroundColor: "#0f172a",
  25. padding: 60,
  26. flexDirection: "column",
  27. justifyContent: "space-between",
  28. },
  29. children: ["top-row", "content", "bottom-row"],
  30. },
  31. "top-row": {
  32. type: "Row",
  33. props: { gap: 12, alignItems: "center" },
  34. children: ["logo-dot", "brand"],
  35. },
  36. "logo-dot": {
  37. type: "Box",
  38. props: {
  39. width: 32,
  40. height: 32,
  41. backgroundColor: "#6366f1",
  42. borderRadius: 16,
  43. },
  44. children: [],
  45. },
  46. brand: {
  47. type: "Text",
  48. props: { text: "acme.dev", fontSize: 24, color: "#94a3b8" },
  49. children: [],
  50. },
  51. content: {
  52. type: "Column",
  53. props: { gap: 16 },
  54. children: ["title", "subtitle"],
  55. },
  56. title: {
  57. type: "Heading",
  58. props: {
  59. text: "Build faster with the modern developer platform",
  60. level: "h1",
  61. color: "#f8fafc",
  62. letterSpacing: "-0.02em",
  63. lineHeight: 1.1,
  64. },
  65. children: [],
  66. },
  67. subtitle: {
  68. type: "Text",
  69. props: {
  70. text: "Ship production-ready apps in minutes, not months.",
  71. fontSize: 24,
  72. color: "#94a3b8",
  73. lineHeight: 1.4,
  74. },
  75. children: [],
  76. },
  77. "bottom-row": {
  78. type: "Row",
  79. props: { gap: 8, alignItems: "center" },
  80. children: ["url"],
  81. },
  82. url: {
  83. type: "Text",
  84. props: {
  85. text: "acme.dev/platform",
  86. fontSize: 18,
  87. color: "#6366f1",
  88. fontWeight: "bold",
  89. },
  90. children: [],
  91. },
  92. },
  93. },
  94. },
  95. // ==========================================================================
  96. // Blog Post Card
  97. // ==========================================================================
  98. {
  99. name: "blog-card",
  100. label: "Blog Post Card",
  101. description: "Social card for a blog post with author info",
  102. spec: {
  103. root: "frame",
  104. elements: {
  105. frame: {
  106. type: "Frame",
  107. props: {
  108. width: 1200,
  109. height: 630,
  110. backgroundColor: "#ffffff",
  111. padding: 60,
  112. flexDirection: "column",
  113. justifyContent: "space-between",
  114. },
  115. children: ["header", "body", "footer"],
  116. },
  117. header: {
  118. type: "Row",
  119. props: { gap: 10, alignItems: "center" },
  120. children: ["category-badge"],
  121. },
  122. "category-badge": {
  123. type: "Box",
  124. props: {
  125. backgroundColor: "#dbeafe",
  126. borderRadius: 20,
  127. paddingTop: 6,
  128. paddingBottom: 6,
  129. paddingLeft: 16,
  130. paddingRight: 16,
  131. },
  132. children: ["category-text"],
  133. },
  134. "category-text": {
  135. type: "Text",
  136. props: {
  137. text: "Engineering",
  138. fontSize: 16,
  139. color: "#1d4ed8",
  140. fontWeight: "bold",
  141. },
  142. children: [],
  143. },
  144. body: {
  145. type: "Column",
  146. props: { gap: 20 },
  147. children: ["blog-title", "blog-excerpt"],
  148. },
  149. "blog-title": {
  150. type: "Heading",
  151. props: {
  152. text: "How We Reduced API Latency by 90% with Edge Computing",
  153. level: "h1",
  154. color: "#0f172a",
  155. letterSpacing: "-0.02em",
  156. lineHeight: 1.15,
  157. },
  158. children: [],
  159. },
  160. "blog-excerpt": {
  161. type: "Text",
  162. props: {
  163. text: "A deep dive into our migration from centralized servers to edge functions, and the performance gains we achieved along the way.",
  164. fontSize: 22,
  165. color: "#64748b",
  166. lineHeight: 1.5,
  167. },
  168. children: [],
  169. },
  170. footer: {
  171. type: "Row",
  172. props: { gap: 16, alignItems: "center" },
  173. children: ["author-avatar", "author-info"],
  174. },
  175. "author-avatar": {
  176. type: "Box",
  177. props: {
  178. width: 48,
  179. height: 48,
  180. backgroundColor: "#e2e8f0",
  181. borderRadius: 24,
  182. },
  183. children: [],
  184. },
  185. "author-info": {
  186. type: "Column",
  187. props: { gap: 2 },
  188. children: ["author-name", "author-date"],
  189. },
  190. "author-name": {
  191. type: "Text",
  192. props: {
  193. text: "Sarah Chen",
  194. fontSize: 18,
  195. color: "#0f172a",
  196. fontWeight: "bold",
  197. },
  198. children: [],
  199. },
  200. "author-date": {
  201. type: "Text",
  202. props: {
  203. text: "February 15, 2026",
  204. fontSize: 16,
  205. color: "#94a3b8",
  206. },
  207. children: [],
  208. },
  209. },
  210. },
  211. },
  212. // ==========================================================================
  213. // Event Banner
  214. // ==========================================================================
  215. {
  216. name: "event-banner",
  217. label: "Event Banner",
  218. description: "Wide promotional banner for an event (1920x1080)",
  219. spec: {
  220. root: "frame",
  221. elements: {
  222. frame: {
  223. type: "Frame",
  224. props: {
  225. width: 1920,
  226. height: 1080,
  227. backgroundColor: "#18181b",
  228. padding: 100,
  229. flexDirection: "column",
  230. alignItems: "center",
  231. justifyContent: "center",
  232. },
  233. children: [
  234. "badge-row",
  235. "spacer-1",
  236. "event-title",
  237. "spacer-2",
  238. "details-row",
  239. "spacer-3",
  240. "cta",
  241. ],
  242. },
  243. "badge-row": {
  244. type: "Row",
  245. props: { alignItems: "center", justifyContent: "center" },
  246. children: ["live-badge"],
  247. },
  248. "live-badge": {
  249. type: "Box",
  250. props: {
  251. backgroundColor: "#dc2626",
  252. borderRadius: 24,
  253. paddingTop: 8,
  254. paddingBottom: 8,
  255. paddingLeft: 24,
  256. paddingRight: 24,
  257. },
  258. children: ["live-text"],
  259. },
  260. "live-text": {
  261. type: "Text",
  262. props: {
  263. text: "LIVE EVENT",
  264. fontSize: 18,
  265. color: "#ffffff",
  266. fontWeight: "bold",
  267. letterSpacing: "0.1em",
  268. },
  269. children: [],
  270. },
  271. "spacer-1": {
  272. type: "Spacer",
  273. props: { height: 40 },
  274. children: [],
  275. },
  276. "event-title": {
  277. type: "Heading",
  278. props: {
  279. text: "DevConf 2026",
  280. level: "h1",
  281. color: "#ffffff",
  282. align: "center",
  283. letterSpacing: "-0.03em",
  284. lineHeight: 1.0,
  285. },
  286. children: [],
  287. },
  288. "spacer-2": {
  289. type: "Spacer",
  290. props: { height: 32 },
  291. children: [],
  292. },
  293. "details-row": {
  294. type: "Row",
  295. props: {
  296. gap: 40,
  297. alignItems: "center",
  298. justifyContent: "center",
  299. },
  300. children: ["date-text", "dot-sep", "location-text"],
  301. },
  302. "date-text": {
  303. type: "Text",
  304. props: {
  305. text: "March 15-17, 2026",
  306. fontSize: 28,
  307. color: "#a1a1aa",
  308. },
  309. children: [],
  310. },
  311. "dot-sep": {
  312. type: "Text",
  313. props: { text: "/", fontSize: 28, color: "#52525b" },
  314. children: [],
  315. },
  316. "location-text": {
  317. type: "Text",
  318. props: {
  319. text: "San Francisco, CA",
  320. fontSize: 28,
  321. color: "#a1a1aa",
  322. },
  323. children: [],
  324. },
  325. "spacer-3": {
  326. type: "Spacer",
  327. props: { height: 48 },
  328. children: [],
  329. },
  330. cta: {
  331. type: "Box",
  332. props: {
  333. backgroundColor: "#6366f1",
  334. borderRadius: 12,
  335. paddingTop: 16,
  336. paddingBottom: 16,
  337. paddingLeft: 48,
  338. paddingRight: 48,
  339. alignItems: "center",
  340. justifyContent: "center",
  341. },
  342. children: ["cta-text"],
  343. },
  344. "cta-text": {
  345. type: "Text",
  346. props: {
  347. text: "Register Now",
  348. fontSize: 24,
  349. color: "#ffffff",
  350. fontWeight: "bold",
  351. letterSpacing: "0.02em",
  352. },
  353. children: [],
  354. },
  355. },
  356. },
  357. },
  358. // ==========================================================================
  359. // Social Square
  360. // ==========================================================================
  361. {
  362. name: "social-square",
  363. label: "Social Square",
  364. description: "Square format card for Instagram or social media (1080x1080)",
  365. spec: {
  366. root: "frame",
  367. elements: {
  368. frame: {
  369. type: "Frame",
  370. props: {
  371. width: 1080,
  372. height: 1080,
  373. backgroundColor: "#faf5ff",
  374. padding: 80,
  375. flexDirection: "column",
  376. justifyContent: "space-between",
  377. },
  378. children: ["top-section", "quote-section", "bottom-section"],
  379. },
  380. "top-section": {
  381. type: "Row",
  382. props: {
  383. alignItems: "center",
  384. justifyContent: "space-between",
  385. },
  386. children: ["quote-icon", "slide-number"],
  387. },
  388. "quote-icon": {
  389. type: "Heading",
  390. props: { text: '"', level: "h1", color: "#9333ea" },
  391. children: [],
  392. },
  393. "slide-number": {
  394. type: "Text",
  395. props: {
  396. text: "01 / 05",
  397. fontSize: 18,
  398. color: "#a855f7",
  399. fontWeight: "bold",
  400. letterSpacing: "0.1em",
  401. },
  402. children: [],
  403. },
  404. "quote-section": {
  405. type: "Column",
  406. props: { gap: 24 },
  407. children: ["quote-text"],
  408. },
  409. "quote-text": {
  410. type: "Heading",
  411. props: {
  412. text: "The best way to predict the future is to create it.",
  413. level: "h2",
  414. color: "#1e1b4b",
  415. letterSpacing: "-0.01em",
  416. lineHeight: 1.3,
  417. },
  418. children: [],
  419. },
  420. "bottom-section": {
  421. type: "Column",
  422. props: { gap: 4 },
  423. children: ["author-name-sq", "author-title"],
  424. },
  425. "author-name-sq": {
  426. type: "Text",
  427. props: {
  428. text: "Peter Drucker",
  429. fontSize: 22,
  430. color: "#1e1b4b",
  431. fontWeight: "bold",
  432. },
  433. children: [],
  434. },
  435. "author-title": {
  436. type: "Text",
  437. props: {
  438. text: "Management Consultant & Author",
  439. fontSize: 18,
  440. color: "#7c3aed",
  441. },
  442. children: [],
  443. },
  444. },
  445. },
  446. },
  447. // ==========================================================================
  448. // Bar Graph
  449. // ==========================================================================
  450. {
  451. name: "bar-graph",
  452. label: "Bar Graph",
  453. description: "Data visualization bar chart (1200x630)",
  454. spec: {
  455. root: "frame",
  456. elements: {
  457. frame: {
  458. type: "Frame",
  459. props: {
  460. width: 1200,
  461. height: 630,
  462. backgroundColor: "#ffffff",
  463. padding: 48,
  464. flexDirection: "column",
  465. },
  466. children: ["header", "chart-area"],
  467. },
  468. header: {
  469. type: "Column",
  470. props: { gap: 4 },
  471. children: ["chart-title", "chart-subtitle"],
  472. },
  473. "chart-title": {
  474. type: "Heading",
  475. props: {
  476. text: "Monthly Revenue",
  477. level: "h2",
  478. color: "#0f172a",
  479. letterSpacing: "-0.02em",
  480. lineHeight: 1.2,
  481. },
  482. children: [],
  483. },
  484. "chart-subtitle": {
  485. type: "Text",
  486. props: {
  487. text: "Q3-Q4 2025 (in thousands USD)",
  488. fontSize: 18,
  489. color: "#94a3b8",
  490. },
  491. children: [],
  492. },
  493. "chart-area": {
  494. type: "Row",
  495. props: {
  496. gap: 0,
  497. alignItems: "flex-end",
  498. justifyContent: "space-between",
  499. flex: 1,
  500. },
  501. children: [
  502. "bar-jul",
  503. "bar-aug",
  504. "bar-sep",
  505. "bar-oct",
  506. "bar-nov",
  507. "bar-dec",
  508. ],
  509. },
  510. "bar-jul": {
  511. type: "Column",
  512. props: {
  513. gap: 8,
  514. alignItems: "center",
  515. justifyContent: "flex-end",
  516. flex: 1,
  517. },
  518. children: ["val-jul", "rect-jul", "lbl-jul"],
  519. },
  520. "val-jul": {
  521. type: "Text",
  522. props: {
  523. text: "$42k",
  524. fontSize: 16,
  525. color: "#64748b",
  526. align: "center",
  527. fontWeight: "bold",
  528. },
  529. children: [],
  530. },
  531. "rect-jul": {
  532. type: "Box",
  533. props: {
  534. width: 80,
  535. height: 168,
  536. backgroundColor: "#6366f1",
  537. borderRadius: 8,
  538. },
  539. children: [],
  540. },
  541. "lbl-jul": {
  542. type: "Text",
  543. props: {
  544. text: "Jul",
  545. fontSize: 16,
  546. color: "#64748b",
  547. align: "center",
  548. },
  549. children: [],
  550. },
  551. "bar-aug": {
  552. type: "Column",
  553. props: {
  554. gap: 8,
  555. alignItems: "center",
  556. justifyContent: "flex-end",
  557. flex: 1,
  558. },
  559. children: ["val-aug", "rect-aug", "lbl-aug"],
  560. },
  561. "val-aug": {
  562. type: "Text",
  563. props: {
  564. text: "$58k",
  565. fontSize: 16,
  566. color: "#64748b",
  567. align: "center",
  568. fontWeight: "bold",
  569. },
  570. children: [],
  571. },
  572. "rect-aug": {
  573. type: "Box",
  574. props: {
  575. width: 80,
  576. height: 232,
  577. backgroundColor: "#6366f1",
  578. borderRadius: 8,
  579. },
  580. children: [],
  581. },
  582. "lbl-aug": {
  583. type: "Text",
  584. props: {
  585. text: "Aug",
  586. fontSize: 16,
  587. color: "#64748b",
  588. align: "center",
  589. },
  590. children: [],
  591. },
  592. "bar-sep": {
  593. type: "Column",
  594. props: {
  595. gap: 8,
  596. alignItems: "center",
  597. justifyContent: "flex-end",
  598. flex: 1,
  599. },
  600. children: ["val-sep", "rect-sep", "lbl-sep"],
  601. },
  602. "val-sep": {
  603. type: "Text",
  604. props: {
  605. text: "$51k",
  606. fontSize: 16,
  607. color: "#64748b",
  608. align: "center",
  609. fontWeight: "bold",
  610. },
  611. children: [],
  612. },
  613. "rect-sep": {
  614. type: "Box",
  615. props: {
  616. width: 80,
  617. height: 204,
  618. backgroundColor: "#6366f1",
  619. borderRadius: 8,
  620. },
  621. children: [],
  622. },
  623. "lbl-sep": {
  624. type: "Text",
  625. props: {
  626. text: "Sep",
  627. fontSize: 16,
  628. color: "#64748b",
  629. align: "center",
  630. },
  631. children: [],
  632. },
  633. "bar-oct": {
  634. type: "Column",
  635. props: {
  636. gap: 8,
  637. alignItems: "center",
  638. justifyContent: "flex-end",
  639. flex: 1,
  640. },
  641. children: ["val-oct", "rect-oct", "lbl-oct"],
  642. },
  643. "val-oct": {
  644. type: "Text",
  645. props: {
  646. text: "$73k",
  647. fontSize: 16,
  648. color: "#64748b",
  649. align: "center",
  650. fontWeight: "bold",
  651. },
  652. children: [],
  653. },
  654. "rect-oct": {
  655. type: "Box",
  656. props: {
  657. width: 80,
  658. height: 292,
  659. backgroundColor: "#818cf8",
  660. borderRadius: 8,
  661. },
  662. children: [],
  663. },
  664. "lbl-oct": {
  665. type: "Text",
  666. props: {
  667. text: "Oct",
  668. fontSize: 16,
  669. color: "#64748b",
  670. align: "center",
  671. },
  672. children: [],
  673. },
  674. "bar-nov": {
  675. type: "Column",
  676. props: {
  677. gap: 8,
  678. alignItems: "center",
  679. justifyContent: "flex-end",
  680. flex: 1,
  681. },
  682. children: ["val-nov", "rect-nov", "lbl-nov"],
  683. },
  684. "val-nov": {
  685. type: "Text",
  686. props: {
  687. text: "$85k",
  688. fontSize: 16,
  689. color: "#64748b",
  690. align: "center",
  691. fontWeight: "bold",
  692. },
  693. children: [],
  694. },
  695. "rect-nov": {
  696. type: "Box",
  697. props: {
  698. width: 80,
  699. height: 340,
  700. backgroundColor: "#818cf8",
  701. borderRadius: 8,
  702. },
  703. children: [],
  704. },
  705. "lbl-nov": {
  706. type: "Text",
  707. props: {
  708. text: "Nov",
  709. fontSize: 16,
  710. color: "#64748b",
  711. align: "center",
  712. },
  713. children: [],
  714. },
  715. "bar-dec": {
  716. type: "Column",
  717. props: {
  718. gap: 8,
  719. alignItems: "center",
  720. justifyContent: "flex-end",
  721. flex: 1,
  722. },
  723. children: ["val-dec", "rect-dec", "lbl-dec"],
  724. },
  725. "val-dec": {
  726. type: "Text",
  727. props: {
  728. text: "$97k",
  729. fontSize: 16,
  730. color: "#64748b",
  731. align: "center",
  732. fontWeight: "bold",
  733. },
  734. children: [],
  735. },
  736. "rect-dec": {
  737. type: "Box",
  738. props: {
  739. width: 80,
  740. height: 388,
  741. backgroundColor: "#4f46e5",
  742. borderRadius: 8,
  743. },
  744. children: [],
  745. },
  746. "lbl-dec": {
  747. type: "Text",
  748. props: {
  749. text: "Dec",
  750. fontSize: 16,
  751. color: "#64748b",
  752. align: "center",
  753. },
  754. children: [],
  755. },
  756. },
  757. },
  758. },
  759. ];