Files
gemini-cli/packages/cli/src/ui/components/messages/InfoMessage.tsx
T

42 lines
960 B
TypeScript
Raw Normal View History

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
2025-04-15 21:41:08 -07:00
import { Text, Box } from 'ink';
2025-09-10 10:57:07 -07:00
import { theme } from '../../semantic-colors.js';
import { RenderInline } from '../../utils/InlineMarkdownRenderer.js';
2025-04-15 21:41:08 -07:00
interface InfoMessageProps {
2025-04-17 18:06:21 -04:00
text: string;
icon?: string;
color?: string;
2025-04-15 21:41:08 -07:00
}
export const InfoMessage: React.FC<InfoMessageProps> = ({
text,
icon,
color,
}) => {
color ??= theme.status.warning;
const prefix = icon ?? ' ';
2025-04-17 18:06:21 -04:00
const prefixWidth = prefix.length;
2025-04-15 21:41:08 -07:00
2025-04-17 18:06:21 -04:00
return (
2025-05-09 22:47:18 -07:00
<Box flexDirection="row" marginTop={1}>
2025-04-17 18:06:21 -04:00
<Box width={prefixWidth}>
<Text color={color}>{prefix}</Text>
2025-04-17 18:06:21 -04:00
</Box>
<Box flexGrow={1} flexDirection="column">
{text.split('\n').map((line, index) => (
<Text wrap="wrap" key={index}>
<RenderInline text={line} defaultColor={color} />
</Text>
))}
2025-04-17 18:06:21 -04:00
</Box>
</Box>
);
2025-04-15 21:41:08 -07:00
};