import React, { useState } from 'react'; import { InsuranceQuote } from '../types'; interface QuoteCardProps { quote: InsuranceQuote; onBuy?: () => void; } const QuoteCard: React.FC = ({ quote, onBuy }) => { const [isExpanded, setIsExpanded] = useState(false); // Specific features to highlight on the front line const highlightFeatures = quote.features.filter(f => ['PERSONAL_ACCIDENT_COVER', 'ROAD_SIDE_ASSISTANCE', 'ZERO_DEPRECIATION', 'ENGINE_COVER', 'Tax'].includes(f.label) ).slice(0, 4); // Keep only one line worth of features return (
{/* Top Row: Insurer & Pricing */}
{/* Insurer Logo & Name */}
{quote.insurerName}

{quote.insurerName}

Quick Approval
{/* IDV Value Display */}

IDV Value

₹ {quote.idvValue.toLocaleString()}

{/* Action & Price */}

₹ {(quote.premium + 150).toLocaleString()}

{quote.premium.toLocaleString()}

{/* NEW SECTION: Key features in one line below Buy Now */}
Key Benefits: {highlightFeatures.map((f, i) => (
{f.label.replace(/_/g, ' ')}: {typeof f.value === 'number' && f.value > 1000 ? `₹${(f.value/100000).toFixed(1)}L` : f.value}
))}
{/* Expand/Collapse Toggle Bar */} {/* Expanded Content */} {isExpanded && (

Detailed Coverage & Breakdown

{quote.features.map((feature, idx) => (
{feature.label.replace(/_/g, ' ')}
{feature.value === true || feature.value === 'True' || feature.value === 'Included' || feature.value === 'Yes' ? 'Yes' : feature.value === false || feature.value === 'False' || feature.value === 'No' ? 'No' : feature.value}
))}
)}
); }; export default QuoteCard;