UI: typography init flag to omit color class

This commit is contained in:
Johannes Kirschbauer
2025-01-03 16:37:25 +01:00
parent 47e3c38a12
commit bf62792baa

View File

@@ -85,6 +85,9 @@ interface _TypographyProps<H extends Hierarchy> {
tag?: Tag; tag?: Tag;
class?: string; class?: string;
classList?: Record<string, boolean>; classList?: Record<string, boolean>;
// Disable using the color prop
// A font color is provided via class / classList or inherited
useExternColor?: boolean;
} }
export const Typography = <H extends Hierarchy>(props: _TypographyProps<H>) => { export const Typography = <H extends Hierarchy>(props: _TypographyProps<H>) => {
@@ -92,7 +95,7 @@ export const Typography = <H extends Hierarchy>(props: _TypographyProps<H>) => {
<Dynamic <Dynamic
component={props.tag || "span"} component={props.tag || "span"}
class={cx( class={cx(
colorMap[props.color || "primary"], !props.useExternColor && colorMap[props.color || "primary"],
props.inverted && "fnt-clr--inverted", props.inverted && "fnt-clr--inverted",
sizeHierarchyMap[props.hierarchy][props.size] as string, sizeHierarchyMap[props.hierarchy][props.size] as string,
weightMap[props.weight || "normal"], weightMap[props.weight || "normal"],