|
1 | 1 | "use client"; |
2 | 2 |
|
| 3 | +import { Highlight, type PrismTheme } from "prism-react-renderer"; |
| 4 | + |
| 5 | +// Custom theme matching site colors (same as Quickstart) |
| 6 | +const customTheme: PrismTheme = { |
| 7 | + plain: { |
| 8 | + color: "#F5F0E8", // warm cream |
| 9 | + backgroundColor: "#3D2B1F", // chocolate brown |
| 10 | + }, |
| 11 | + styles: [ |
| 12 | + { |
| 13 | + types: ["comment", "prolog", "doctype", "cdata"], |
| 14 | + style: { color: "#A89F91", fontStyle: "italic" as const }, |
| 15 | + }, |
| 16 | + { |
| 17 | + types: ["punctuation"], |
| 18 | + style: { color: "#D4A574" }, // muted gold |
| 19 | + }, |
| 20 | + { |
| 21 | + types: ["property", "tag", "boolean", "number", "constant", "symbol"], |
| 22 | + style: { color: "#E8B87D" }, // mustard gold |
| 23 | + }, |
| 24 | + { |
| 25 | + types: ["selector", "attr-name", "string", "char", "builtin", "inserted"], |
| 26 | + style: { color: "#E07B5E" }, // burnt sienna / coral |
| 27 | + }, |
| 28 | + { |
| 29 | + types: ["atrule", "attr-value", "keyword"], |
| 30 | + style: { color: "#8ECAE6" }, // soft blue |
| 31 | + }, |
| 32 | + { |
| 33 | + types: ["function", "class-name"], |
| 34 | + style: { color: "#F4D35E" }, // bright gold |
| 35 | + }, |
| 36 | + { |
| 37 | + types: ["regex", "important", "variable"], |
| 38 | + style: { color: "#95D5B2" }, // mint green |
| 39 | + }, |
| 40 | + { |
| 41 | + types: ["title"], |
| 42 | + style: { color: "#F4D35E", fontWeight: "bold" as const }, // headers in gold |
| 43 | + }, |
| 44 | + { |
| 45 | + types: ["bold"], |
| 46 | + style: { fontWeight: "bold" as const }, |
| 47 | + }, |
| 48 | + { |
| 49 | + types: ["italic"], |
| 50 | + style: { fontStyle: "italic" as const }, |
| 51 | + }, |
| 52 | + ], |
| 53 | +}; |
| 54 | + |
3 | 55 | export default function HowItWorks() { |
4 | 56 | const workflowCode = `# .github/workflows/stringly-typed.yml |
5 | 57 | name: Stringly-Typed |
|
47 | 99 | stringly-typed.yml |
48 | 100 | </span> |
49 | 101 | </div> |
50 | | - <pre className="bg-[var(--chocolate-brown)] p-4 text-sm font-mono text-[var(--warm-cream)] overflow-x-auto leading-relaxed"> |
51 | | - <code>{workflowCode}</code> |
52 | | - </pre> |
| 102 | + <Highlight |
| 103 | + theme={customTheme} |
| 104 | + code={workflowCode} |
| 105 | + language="yaml" |
| 106 | + > |
| 107 | + {({ className, style, tokens, getLineProps, getTokenProps }) => ( |
| 108 | + <pre |
| 109 | + className={`${className} p-4 text-sm font-mono overflow-x-auto leading-relaxed`} |
| 110 | + style={style} |
| 111 | + > |
| 112 | + {tokens.map((line, i) => ( |
| 113 | + <div key={i} {...getLineProps({ line })}> |
| 114 | + {line.map((token, key) => ( |
| 115 | + <span key={key} {...getTokenProps({ token })} /> |
| 116 | + ))} |
| 117 | + </div> |
| 118 | + ))} |
| 119 | + </pre> |
| 120 | + )} |
| 121 | + </Highlight> |
53 | 122 | </div> |
54 | 123 | </div> |
55 | 124 |
|
|
0 commit comments