forked from bots-garden/ori
| ✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme | 1 | /** |
| 2 | * InlineText renders a one-line string in which `backtick` spans become | |
| 3 | * monospace <code> elements — for tool call titles, permission titles and | |
| 4 | * plan entries, where full markdown would be overkill but agents routinely | |
| 5 | * quote commands and paths. | |
| 6 | * | |
| 7 | * @example | |
| 8 | * <InlineText text="Run `ls .memory/`" /> | |
| 9 | */ | |
| 10 | ||
| 11 | export function InlineText({ text }: { text: string }) { | |
| 12 | // Even segments are plain text, odd segments were between backticks. | |
| 13 | const parts = text.split("`"); | |
| 14 | return ( | |
| 15 | <> | |
| 16 | {parts.map((part, index) => | |
| 17 | index % 2 === 1 ? ( | |
| 18 | <code key={`${index}:${part}`} className="inline-code"> | |
| 19 | {part} | |
| 20 | </code> | |
| 21 | ) : ( | |
| 22 | part | |
| 23 | ), | |
| 24 | )} | |
| 25 | </> | |
| 26 | ); | |
| 27 | } |