import React from 'react'; import { Box, Text } from 'ink'; import { colors, borders } from '../theme/index.js'; export interface CardProps { /** Content to render inside the card */ children: React.ReactNode; /** Optional title for the card header */ title?: string; /** Card width (default: 100%) */ width?: number | string; /** Border style */ borderStyle?: 'single' | 'rounded' | 'double'; /** Border color */ borderColor?: string; /** Padding inside the card */ padding?: number; /** Whether to show shadow effect */ shadow?: boolean; } /** * Card component for consistent box styling throughout the UI. * Provides bordered containers with optional titles and various styles. */ export const Card: React.FC = ({ children, title, width, borderStyle = 'rounded', borderColor = colors.muted, padding = 1, shadow = false, }) => { const cornerSet = borderStyle === 'double' ? borders.double : borderStyle === 'rounded' ? borders.rounded : borders.corners; const horizontal = borderStyle === 'double' ? borders.double.horizontal : borders.horizontal; const vertical = borderStyle === 'double' ? borders.double.vertical : borders.vertical; return ( {/* Top border with optional title */} {cornerSet.topLeft} {title ? ( <> {horizontal} {` ${title} `} {horizontal.repeat(10)} ) : ( horizontal.repeat(20) )} {cornerSet.topRight} {/* Content area */} {vertical} {children} {vertical} {shadow && } {/* Bottom border */} {cornerSet.bottomLeft} {horizontal.repeat(20)} {cornerSet.bottomRight} {shadow && } ); }; export default Card;