({ code }: { code: string })
| 48 | } |
| 49 | |
| 50 | function CodeLines({ code }: { code: string }) { |
| 51 | return ( |
| 52 | <> |
| 53 | {code.split('\n').map((line, i) => { |
| 54 | const isComment = line.trim().startsWith('#') |
| 55 | const isPrompt = line.trim().startsWith('>') |
| 56 | if (line === '') return <span key={i} className="block h-3" /> |
| 57 | if (isComment) return ( |
| 58 | <div key={i}> |
| 59 | <span className="text-[#999] dark:text-[#555]">{line}</span> |
| 60 | </div> |
| 61 | ) |
| 62 | if (isPrompt) return ( |
| 63 | <div key={i}> |
| 64 | <span className="text-[#bbb] dark:text-[#555] select-none">{'> '}</span> |
| 65 | <span className="text-[#111] dark:text-[#e8e8e8]">{line.replace(/^>\s*/, '')}</span> |
| 66 | </div> |
| 67 | ) |
| 68 | return ( |
| 69 | <div key={i}> |
| 70 | <span className="text-[#111] dark:text-[#e8e8e8]">{line}</span> |
| 71 | </div> |
| 72 | ) |
| 73 | })} |
| 74 | </> |
| 75 | ) |
| 76 | } |
| 77 | |
| 78 | function CopyButton({ copied, copy }: { copied: boolean; copy: () => void }) { |
| 79 | return ( |
nothing calls this directly
no outgoing calls
no test coverage detected