diff --git a/apps/client/src/widgets/react/Card.css b/apps/client/src/widgets/react/Card.css
index ce6bf6dc61..cabc4a0889 100644
--- a/apps/client/src/widgets/react/Card.css
+++ b/apps/client/src/widgets/react/Card.css
@@ -6,7 +6,15 @@
--card-nested-section-indent: 30px;
}
-.tn-card {
+.tn-card-heading {
+ margin-bottom: 10px;
+ font-size: .75rem;
+ font-weight: 600;
+ letter-spacing: .4pt;
+ text-transform: uppercase;
+}
+
+.tn-card-body {
display: flex;
flex-direction: column;
gap: var(--card-section-gap);
@@ -35,6 +43,5 @@
background-color: var(--card-background-hover-color);
transition: background-color .2s ease-out;
}
-
}
}
\ No newline at end of file
diff --git a/apps/client/src/widgets/react/Card.tsx b/apps/client/src/widgets/react/Card.tsx
index 26b52040be..224a151504 100644
--- a/apps/client/src/widgets/react/Card.tsx
+++ b/apps/client/src/widgets/react/Card.tsx
@@ -4,17 +4,27 @@ import { JSX } from "preact";
import { useContext } from "preact/hooks";
import clsx from "clsx";
-interface CardProps {
+// #region Card
+
+export interface CardProps {
className?: string;
+ heading?: string;
}
export function Card(props: {children: ComponentChildren} & CardProps) {
- return
- {props.children}
+ return
+ {props.heading &&
{props.heading}
}
+
+ {props.children}
+
;
}
-interface CardSectionProps {
+// #endregion
+
+// #region Card Section
+
+export interface CardSectionProps {
className?: string;
subSections?: JSX.Element | JSX.Element[];
subSectionsVisible?: boolean;
@@ -22,6 +32,12 @@ interface CardSectionProps {
onAction?: () => void;
}
+interface CardSectionContextType {
+ nestingLevel: number;
+}
+
+const CardSectionContext = createContext
(undefined);
+
export function CardSection(props: {children: ComponentChildren} & CardSectionProps) {
const parentContext = useContext(CardSectionContext);
const nestingLevel = (parentContext && parentContext.nestingLevel + 1) ?? 0;
@@ -31,12 +47,12 @@ 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}
- {props.subSectionsVisible &&
+ {props.subSectionsVisible && props.subSections &&
{props.subSections}
@@ -44,8 +60,4 @@ export function CardSection(props: {children: ComponentChildren} & CardSectionPr
>;
}
-interface CardSectionContextType {
- nestingLevel: number;
-}
-
-export const CardSectionContext = createContext(undefined);
\ No newline at end of file
+// #endregion
\ No newline at end of file