"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); // Size-based styling const isLarge = size === "L"; // Card dimensions - make width flexible for grid layouts, but can be overridden via className // For standalone/preview use, add fixed width via className const cardPadding = isLarge ? "p-[24px]" : "p-[16px]"; const cardGap = expanded ? "gap-[16px]" : isLarge ? "gap-[10px]" : "gap-[12px]"; // 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]"; // Category label typography const categoryLabelClass = "font-inter font-normal text-[14px] leading-[20px]"; // Pill typography const pillTextClass = "font-inter font-medium text-[12px] leading-[14px]"; // 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}