From be12658864448d24d9beacab8ff07280548d3303 Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Sat, 14 Feb 2026 00:08:00 +0200 Subject: [PATCH] client/ui/cards: add support for custom class names and action callbacks --- apps/client/src/widgets/react/Card.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/react/Card.tsx b/apps/client/src/widgets/react/Card.tsx index fa6a0f489f..1573c2fe0b 100644 --- a/apps/client/src/widgets/react/Card.tsx +++ b/apps/client/src/widgets/react/Card.tsx @@ -5,17 +5,21 @@ import { useContext } from "preact/hooks"; import clsx from "clsx"; interface CardProps { + className?: string; } export function Card(props: {children: ComponentChildren} & CardProps) { - return
+ return
{props.children}
; } interface CardSectionProps { + className?: string; subSections?: JSX.Element | JSX.Element[]; childrenVisible?: boolean; + hasAction: boolean; + onAction?: () => void; } export function CardSection(props: {children: ComponentChildren} & CardSectionProps) { @@ -23,9 +27,13 @@ export function CardSection(props: {children: ComponentChildren} & CardSectionPr const nestingLevel = (parentContext && parentContext.nestingLevel + 1) ?? 0; return <> -
0}])} - style={"--tn-card-section-nesting-level: " + nestingLevel}> - {props.children} {nestingLevel} +
0, + "tn-action": props?.hasAction} + ], props.className)} + style={"--tn-card-section-nesting-level: " + nestingLevel} + onClick={() => {props.onAction?.()}}> + {props.children}
{props?.childrenVisible &&