Files
simple-react-app-kit/packages/i18n/src/devtool/devtool-action-output.tsx
T
Maofeng 0768e8fa29 feat(i18n): expand catalog runtime and developer tooling
- add Intl-backed locale definitions, formatters, catalog loaders, and runtime hooks\n- compile hashed production catalogs from package-scoped catalog sources\n- drive Lingui extraction and compilation directly from project JSON config\n- redesign the devtool with localized controls, draggable persistence, settings, navigation, copy actions, ANSI output, and fullscreen support\n- extend repository APIs, CLI coverage, documentation, and runtime tests
2026-07-30 14:47:42 +08:00

66 lines
1.6 KiB
TypeScript

import {
ChevronDownIcon,
ChevronUpIcon,
TerminalIcon,
XIcon,
} from "lucide-react"
import { AnsiText } from "./ansi-text"
import { useDevtoolLocalization } from "./devtool-localization"
export interface DevtoolActionOutputProps {
error?: boolean
expanded: boolean
onClose: () => void
onExpandedChange: (expanded: boolean) => void
output: string
}
export function DevtoolActionOutput({
error = false,
expanded,
onClose,
onExpandedChange,
output,
}: DevtoolActionOutputProps) {
const ToggleIcon = expanded ? ChevronUpIcon : ChevronDownIcon
const { messages } = useDevtoolLocalization()
return (
<section className="i18n-devtool__output" data-error={error || undefined}>
<header className="i18n-devtool__output-header">
<span>
<TerminalIcon aria-hidden="true" />
{messages.commandOutput.title}
</span>
<div>
<button
type="button"
aria-expanded={expanded}
aria-label={
expanded
? messages.commandOutput.collapse
: messages.commandOutput.expand
}
onClick={() => onExpandedChange(!expanded)}
>
<ToggleIcon aria-hidden="true" />
</button>
<button
type="button"
aria-label={messages.commandOutput.close}
onClick={onClose}
>
<XIcon aria-hidden="true" />
</button>
</div>
</header>
{expanded && (
<pre>
<AnsiText>{output}</AnsiText>
</pre>
)}
</section>
)
}