'use client'; import { type FC, type ReactNode } from 'react'; /** * Feature configuration for bot feature cards */ export interface BotFeature { icon: string; title: string; description: string; /** Optional detailed description shown below main description */ details?: string; /** Gradient color for icon background (Tailwind gradient classes) */ color?: string; } interface BotFeatureCardProps { feature: BotFeature; /** Optional variant for different styling */ variant?: 'default' | 'gradient' | 'simple'; /** Optional click handler for interactive cards */ onClick?: () => void; /** Whether the card is in selected/expanded state */ isSelected?: boolean; /** Optional children for expanded content */ children?: ReactNode; } /** * Shared Feature Card component for bot pages * * Provides consistent styling for feature cards across all bot pages * while allowing customization through variants and optional expanded content. * * @example * ```tsx * // Simple feature card * * * // Interactive card with expanded content * setExpanded(!expanded)} * isSelected={expanded} * > * Expanded content here * * ``` */ export const BotFeatureCard: FC = ({ feature, variant = 'default', onClick, isSelected = false, children, }) => { const { icon, title, description, details, color = 'from-gray-500 to-gray-600' } = feature; const baseClasses = 'relative bg-white rounded-2xl p-6 transition-all'; const interactiveClasses = onClick ? 'cursor-pointer' : ''; const variantClasses = { default: `${baseClasses} border-2 border-gray-100 hover:border-gray-200 hover:shadow-xl`, gradient: `${baseClasses} border-2 border-gray-100 hover:border-gray-200 hover:shadow-xl group`, simple: `${baseClasses} border ${ isSelected ? 'border-action shadow-md' : 'border-gray-200 shadow-sm hover:shadow-md hover:border-gray-300' }`, }; const iconClasses = { default: `w-12 h-12 bg-gray-100 rounded-full flex items-center justify-center mb-4`, gradient: `w-14 h-14 rounded-xl bg-gradient-to-br ${color} flex items-center justify-center text-2xl text-white mb-4 group-hover:scale-110 transition-transform`, simple: `w-12 h-12 bg-gray-100 rounded-full flex items-center justify-center mb-4`, }; const CardWrapper = onClick ? 'button' : 'div'; const wrapperProps = onClick ? { onClick, type: 'button' as const, className: `${variantClasses[variant]} ${interactiveClasses} w-full text-left`, } : { className: variantClasses[variant] }; return ( {icon} {title} {description} {details && {details}} {children} ); }; /** * Props for the feature grid component */ interface BotFeatureGridProps { /** Array of features to display */ features: BotFeature[]; /** Card variant for all cards in the grid */ variant?: 'default' | 'gradient' | 'simple'; /** Number of columns (responsive) */ columns?: 2 | 3 | 4; /** Optional section header */ header?: { badge?: { emoji?: string; text: string }; title: string; subtitle?: string; }; } /** * Grid layout for multiple feature cards * * @example * ```tsx * * ``` */ export const BotFeatureGrid: FC = ({ features, variant = 'default', columns = 3, header, }) => { const gridCols = { 2: 'sm:grid-cols-2', 3: 'sm:grid-cols-2 lg:grid-cols-3', 4: 'sm:grid-cols-2 lg:grid-cols-4', }; return ( {header && ( {header.badge && ( {header.badge.emoji && {header.badge.emoji}} {header.badge.text} )} {header.title} {header.subtitle && ( {header.subtitle} )} )} {features.map((feature, idx) => ( ))} ); };
{description}
{details}
{header.subtitle}