"use client"; import React, { useState } from "react"; import { ProductCardProps } from "./types"; import { Button } from "@shared/components/button"; import { Checklist } from "@shared/components/checklist"; import { Image } from "@shared/components/image"; import { MaterialIcon } from "@shared/components/material-icon"; import { SelectPlanButton } from "@shared/components/select-plan-button"; import { Text } from "@shared/components/text"; import { cx } from "@shared/utils"; export const ProductCard: React.FC = ({ planName, planSubtext, speed, price, description, bestValue = false, bestValueText = "best value", giftBadge, innerBadge, theme = "light", featuresTitle = "Business Ready Internet features", features = [], isExpanded: controlledExpanded, onToggleExpand, onCtaClick, renderCheckPlans, cta, techType, ismaxSpeed, }) => { const [internalExpanded, setInternalExpanded] = useState(false); // Use parent state if provided, otherwise use internal state const isExpanded = controlledExpanded !== undefined ? controlledExpanded : internalExpanded; const handleToggle = () => { if (onToggleExpand) { onToggleExpand(); } else { setInternalExpanded(!internalExpanded); } }; const isDark = theme === "dark"; return (
{/* Best Value Banner */} {bestValue && (
{bestValueText}
)} {/* Main Card */}
{/* Plan Name & Price */}
{planName} {planSubtext}
$ {price.split(".")[0]} {price.split(".")[1]}/mo
{/* Description */}
{description}
{/* Gift Badge */} {giftBadge?.length ? (
{giftBadge?.map((badge: any) => { return (
{badge.title} {badge.title}
); })}
) : null} {/* CTA */} {/* Features */} {features.length > 0 && (
{innerBadge?.badgeIcon ? (
Inner Badge {innerBadge.badgeText.includes("|") ? ( <> {innerBadge.badgeText.split("|")[0]} {innerBadge.badgeText.split("|")[1]} ) : ( {innerBadge.badgeText} )}
) : null}
)}
); }; export default ProductCard;