({
borderColorKey,
borderColor: borderColorOverride,
textColorKey,
textColor: textColorOverride,
text,
children,
onClose,
border,
})
| 61 | * ``` |
| 62 | */ |
| 63 | export const BottomBanner: React.FC<BottomBannerProps> = ({ |
| 64 | borderColorKey, |
| 65 | borderColor: borderColorOverride, |
| 66 | textColorKey, |
| 67 | textColor: textColorOverride, |
| 68 | text, |
| 69 | children, |
| 70 | onClose, |
| 71 | border, |
| 72 | }) => { |
| 73 | const { width, terminalWidth } = useTerminalLayout() |
| 74 | const theme = useTheme() |
| 75 | const [isCloseHovered, setIsCloseHovered] = useState(false) |
| 76 | |
| 77 | // Resolve colors from theme or use overrides |
| 78 | const themeRecord = theme as unknown as Record<string, string> |
| 79 | const borderColor = borderColorOverride ?? themeRecord[borderColorKey] |
| 80 | const textColor = |
| 81 | textColorOverride ?? |
| 82 | (textColorKey ? themeRecord[textColorKey] : borderColor) |
| 83 | |
| 84 | const hasCloseButton = onClose !== undefined |
| 85 | const hasTextContent = text !== undefined && children === undefined |
| 86 | |
| 87 | return ( |
| 88 | <box |
| 89 | key={terminalWidth} |
| 90 | style={{ |
| 91 | marginLeft: width.is('sm') ? 0 : 1, |
| 92 | marginRight: width.is('sm') ? 0 : 1, |
| 93 | borderStyle: 'single', |
| 94 | borderColor: borderColor, |
| 95 | flexDirection: hasCloseButton ? 'row' : 'column', |
| 96 | justifyContent: hasCloseButton ? 'space-between' : undefined, |
| 97 | paddingLeft: 1, |
| 98 | paddingRight: 1, |
| 99 | marginTop: 0, |
| 100 | marginBottom: 0, |
| 101 | }} |
| 102 | border={border ?? ['bottom', 'left', 'right']} |
| 103 | customBorderChars={BORDER_CHARS} |
| 104 | > |
| 105 | {hasTextContent ? ( |
| 106 | // Simple text content with optional close button |
| 107 | <> |
| 108 | <text |
| 109 | style={{ |
| 110 | fg: textColor, |
| 111 | wrapMode: 'word', |
| 112 | flexShrink: 1, |
| 113 | marginRight: hasCloseButton ? 3 : 0, |
| 114 | }} |
| 115 | > |
| 116 | {text} |
| 117 | </text> |
| 118 | </> |
| 119 | ) : ( |
| 120 | // Custom children content |
nothing calls this directly
no test coverage detected