import React, { useState } from "react"; interface FeaturesProps { features: string[]; } // Rotating gradient colors for feature badges const featureGradients = [ "from-violet-500 to-purple-600", "from-sky-500 to-blue-600", "from-emerald-500 to-teal-600", "from-amber-500 to-orange-600", "from-rose-500 to-pink-600", ]; const CheckIcon: React.FC = () => ( ); const SparkleIcon: React.FC = () => ( ); // Truncate long text to first sentence or max chars const truncateText = (text: string, maxLength: number = 200): { truncated: string; isTruncated: boolean } => { // First try to get first sentence const firstSentenceMatch = text.match(/^[^.!?]*[.!?]/); if (firstSentenceMatch && firstSentenceMatch[0].length <= maxLength) { return { truncated: firstSentenceMatch[0], isTruncated: text.length > firstSentenceMatch[0].length }; } // Otherwise truncate at word boundary if (text.length <= maxLength) { return { truncated: text, isTruncated: false }; } const truncated = text.slice(0, maxLength).replace(/\s+\S*$/, ""); return { truncated: truncated + "...", isTruncated: true }; }; interface FeatureItemProps { feature: string; gradient: string; index: number; } const FeatureItem: React.FC = ({ feature, gradient, index }) => { const [isExpanded, setIsExpanded] = useState(false); const { truncated, isTruncated } = truncateText(feature); return (
{/* Gradient number badge */}
{index + 1}
{/* Feature text */}

{isExpanded ? feature : truncated}

{isTruncated && ( )}
{/* Check icon on hover */}
); }; const MAX_FEATURES_DISPLAY = 5; export const Features: React.FC = ({ features }) => { // Don't render if no features are available if (!features || features.length === 0) { return null; } const displayedFeatures = features.slice(0, MAX_FEATURES_DISPLAY); const remainingCount = features.length - MAX_FEATURES_DISPLAY; return (

Key Features

{displayedFeatures.map((feature, index) => ( ))}
{/* Feature count badge */}
{remainingCount > 0 ? `Top ${MAX_FEATURES_DISPLAY} of ${features.length} Features` : `${features.length} Key Highlights` }
); };