"use client"; import Image from "next/image"; import { useTranslation } from "../../contexts/MessagesContext"; import MultiSelect from "../MultiSelect"; import type { RuleCardViewProps } from "./RuleCard.types"; export function RuleCardView({ title, description, icon, backgroundColor, className, onClick, onKeyDown, expanded, size, categories, logoUrl, logoAlt, communityInitials, }: RuleCardViewProps) { const t = useTranslation("ruleCard"); const ariaLabel = t("ariaLabel")?.replace("{title}", title) || title; // Size-based styling const isLarge = size === "L"; // Card dimensions - fixed width for expanded states (568px for L, 398px for M per Figma) const cardPadding = isLarge ? "p-[24px]" : "p-[16px]"; const cardGap = expanded ? "gap-[16px]" : isLarge ? "gap-[10px]" : "gap-[12px]"; const cardWidth = expanded ? isLarge ? "w-[568px]" : "w-[398px]" : ""; // Logo/Icon dimensions const logoSize = isLarge ? 103 : 56; const logoContainerClass = isLarge ? "size-[103px]" : "size-[56px]"; // Title typography const titleClass = isLarge ? "font-bricolage-grotesque font-extrabold text-[36px] leading-[44px]" : "font-bricolage-grotesque font-bold text-[24px] leading-[32px]"; // Description typography const descriptionClass = isLarge ? "font-inter font-medium text-[18px] leading-[24px]" : "font-inter font-medium text-[14px] leading-[16px]"; // Render logo/icon const renderLogo = () => { if (logoUrl) { // Check if it's a localhost URL or external URL that needs regular img tag const isLocalhost = logoUrl.startsWith("http://localhost") || logoUrl.startsWith("https://localhost"); if (isLocalhost) { return (
{description}
{description}