| 1 | /** @jsxImportSource @alchemy.run/sigil */ |
| 2 | import { useGlyphs } from "./Environment.tsx"; |
| 3 | import { Stack } from "./Layout.tsx"; |
| 4 | import { Text } from "./Typography.tsx"; |
| 5 | |
| 6 | type AnsweredPromptProps = { |
| 7 | readonly message: string; |
| 8 | readonly answer: string; |
| 9 | readonly below?: boolean; |
| 10 | }; |
| 11 | |
| 12 | export function AnsweredPrompt({ |
| 13 | message, |
| 14 | answer, |
| 15 | below = false, |
| 16 | }: AnsweredPromptProps) { |
| 17 | const glyphs = useGlyphs(); |
| 18 | return below ? ( |
| 19 | <Stack> |
| 20 | <Text> |
| 21 | <Text tone="success">{glyphs.success}</Text> {message} |
| 22 | </Text> |
| 23 | <Text tone="muted"> {answer}</Text> |
| 24 | </Stack> |
| 25 | ) : ( |
| 26 | <Text> |
| 27 | <Text tone="success">{glyphs.success}</Text> {message}{" "} |
| 28 | <Text tone="muted">· {answer}</Text> |
| 29 | </Text> |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | type CancelledPromptProps = { readonly message: string }; |
| 34 | |
| 35 | export function CancelledPrompt({ message }: CancelledPromptProps) { |
| 36 | const glyphs = useGlyphs(); |
| 37 | return ( |
| 38 | <Text tone="muted"> |
| 39 | <Text tone="danger">{glyphs.error}</Text> {message} cancelled |
| 40 | </Text> |
| 41 | ); |
| 42 | } |