Files
gemini-cli/packages/cli/src/ui/components/messages/InfoMessage.tsx
2025-11-07 23:17:23 +00:00

42 lines
960 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
import { Text, Box } from 'ink';
import { theme } from '../../semantic-colors.js';
import { RenderInline } from '../../utils/InlineMarkdownRenderer.js';
interface InfoMessageProps {
text: string;
icon?: string;
color?: string;
}
export const InfoMessage: React.FC<InfoMessageProps> = ({
text,
icon,
color,
}) => {
color ??= theme.status.warning;
const prefix = icon ?? ' ';
const prefixWidth = prefix.length;
return (
<Box flexDirection="row" marginTop={1}>
<Box width={prefixWidth}>
<Text color={color}>{prefix}</Text>
</Box>
<Box flexGrow={1} flexDirection="column">
{text.split('\n').map((line, index) => (
<Text wrap="wrap" key={index}>
<RenderInline text={line} defaultColor={color} />
</Text>
))}
</Box>
</Box>
);
};