import React, { useState } from 'react'; import type { FC, KeyboardEvent } from 'react'; import { FiBox, FiHeart, FiInfo, FiMic, FiShoppingCart } from 'react-icons/fi'; import { GoLaw } from 'react-icons/go'; import { PiDotsSixThin } from 'react-icons/pi'; import { DEFAULT_BLUE_RGB, DEFAULT_PINK_RGB, hexToRgb, } from '../../utils/colors'; import TripleStarsIcon from '../icons/TripleStarsIcon'; import DismissIcon from '../icons/DismissIcon'; type ProductDetailsCardProps = { name: string; description: string; bullets: string[]; price: number; currency?: string; imageUrl: string | File | null; inStock?: boolean; statusLabel?: string; likeCount?: number; isLiked?: boolean; textColor: string; buttonColor: string; cartIconColor: string; popupBorderColorLeft: string; popupBorderColorRight: string; showPrices?: boolean; showAddToCartButton?: boolean; onToggleLike?: (liked: boolean) => void; onAddToCart?: () => void; onShowSimilar?: () => void; onAskQuestion?: (question: string) => void; }; type QuestionBarProps = { placeholder: string; popupBorderColorLeft?: string; popupBorderColorRight?: string; onSubmit?: (value: string) => void; }; const QuestionBar: FC = ({ // placeholder, popupBorderColorLeft, popupBorderColorRight, onSubmit, }) => { const [value, setValue] = useState(''); const customStyles = { '--accent-pink-rgb': hexToRgb(popupBorderColorLeft || '') || DEFAULT_PINK_RGB, '--accent-blue-rgb': hexToRgb(popupBorderColorRight || '') || DEFAULT_BLUE_RGB, } as React.CSSProperties; const handleSubmit = () => { const q = value.trim(); if (!q) return; onSubmit?.(q); setValue(''); }; const handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Enter') { e.preventDefault(); handleSubmit(); } }; return (
setValue(e.target.value)} onKeyDown={handleKeyDown} />
); }; export const ProductDetailsCard: FC = ({ name, description, bullets, price, currency = 'USD', imageUrl, inStock = true, statusLabel = 'In stock', likeCount = 1, isLiked = false, buttonColor, cartIconColor, popupBorderColorLeft, popupBorderColorRight, textColor, showPrices = true, showAddToCartButton = true, onToggleLike, onAddToCart, onShowSimilar, onAskQuestion, }) => { const displayPrice = `${currency} ${price.toFixed(2)}`; const customStyles = { '--accent-pink-rgb': hexToRgb(popupBorderColorLeft || '') || '0, 0, 0', } as React.CSSProperties; const leftRgb = hexToRgb(popupBorderColorLeft || ''); const rightRgb = hexToRgb(popupBorderColorRight || ''); const cardStyle: React.CSSProperties = { background: `linear-gradient( to bottom, rgba(${leftRgb}, 0.12) 0%, rgba(${leftRgb}, 0.12) 40%, rgba(${rightRgb}, 0.18) 100% )`, backdropFilter: 'blur(12px)', boxShadow: `0 25px 50px -12px rgba(${rightRgb}, 0.35)`, }; const handleLikeClick = () => { onToggleLike?.(!isLiked); }; return (
{imageUrl ? ( logo ) : ( )}
{name}

{name}

{inStock && (
{statusLabel}
)}

{description}

    {bullets.map(item => (
  • {item}
  • ))}
{showPrices && (
{displayPrice}
)} {showAddToCartButton && ( )}
{[ { title: 'More Details', icon: }, { title: 'Similar Products', icon: }, { title: 'Compare with other', icon: , }, ].map((item, key) => { return ( ); })}
); };