"use client" import { useFormContext } from "react-hook-form" import { CheckIcon, CloseIcon } from "@/components/Icons" import Caption from "@/components/TempDesignSystem/Text/Caption" import Footnote from "@/components/TempDesignSystem/Text/Footnote" import styles from "./card.module.css" import type { CardProps, ListProps, SubtitleProps, TextProps } from "./card" export default function Card({ Icon, iconHeight = 32, iconWidth = 32, declined = false, highlightSubtitle = false, id, list, name, subtitle, text, title, type, value, }: CardProps) { const { register, setValue } = useFormContext() function onLabelClick(event: React.MouseEvent) { // Preventing click event on label elements firing twice: https://github.com/facebook/react/issues/14295 event.preventDefault() setValue(name, value) } return ( ) } function List({ declined, list }: ListProps) { if (!list) { return null } return list.map((listItem) => ( {declined ? ( ) : ( )} {listItem.title} )) } function Subtitle({ highlightSubtitle, subtitle }: SubtitleProps) { if (!subtitle) { return null } return ( {subtitle} ) } function Text({ text }: TextProps) { if (!text) { return null } return ( {text} ) } export function Highlight({ children }: React.PropsWithChildren) { return {children} }