Compare commits

...

2 Commits

Author SHA1 Message Date
Adorian Doran
4ee9d45dfc ui/cards: implement card titles (heading) 2026-02-15 20:06:01 +02:00
Adorian Doran
e00150a876 ui/cards: do not include nesting level CSS variables if not necessary 2026-02-15 19:46:08 +02:00
2 changed files with 16 additions and 4 deletions

View File

@@ -6,6 +6,14 @@
--card-nested-section-indent: 30px;
}
.tn-card-heading {
margin-bottom: 10px;
font-size: .75rem;
font-weight: 600;
letter-spacing: .4pt;
text-transform: uppercase;
}
.tn-card {
display: flex;
flex-direction: column;

View File

@@ -6,12 +6,16 @@ import clsx from "clsx";
interface CardProps {
className?: string;
heading?: string;
}
export function Card(props: {children: ComponentChildren} & CardProps) {
return <div className={clsx(["tn-card", props.className])}>
{props.children}
</div>;
return <>
{props.heading && <h5 class="tn-card-heading">{props.heading}</h5>}
<div className={clsx(["tn-card", props.className])}>
{props.children}
</div>
</>;
}
interface CardSectionProps {
@@ -31,7 +35,7 @@ export function CardSection(props: {children: ComponentChildren} & CardSectionPr
"tn-card-section-nested": nestingLevel > 0,
"tn-card-section-highlight-on-hover": props.highlightOnHover || props.onAction
})}
style={{"--tn-card-section-nesting-level": nestingLevel}}
style={{"--tn-card-section-nesting-level": (nestingLevel) ? nestingLevel : null}}
onClick={props.onAction}>
{props.children}
</section>