UI: typography add color: 'inherit'

This commit is contained in:
Johannes Kirschbauer
2025-01-06 10:20:03 +01:00
parent 7e8f1da220
commit 4ffa33407c
3 changed files with 5 additions and 7 deletions

View File

@@ -80,14 +80,11 @@ interface _TypographyProps<H extends Hierarchy> {
size: AllowedSizes<H>;
children: JSX.Element;
weight?: Weight;
color?: Color;
color?: Color | "inherit";
inverted?: boolean;
tag?: Tag;
class?: string;
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>) => {
@@ -95,7 +92,8 @@ export const Typography = <H extends Hierarchy>(props: _TypographyProps<H>) => {
<Dynamic
component={props.tag || "span"}
class={cx(
!props.useExternColor && colorMap[props.color || "primary"],
props.color === "inherit" && "text-inherit",
props.color !== "inherit" && colorMap[props.color || "primary"],
props.inverted && "fnt-clr--inverted",
sizeHierarchyMap[props.hierarchy][props.size] as string,
weightMap[props.weight || "normal"],

View File

@@ -38,7 +38,7 @@ export const SectionHeader = (props: SectionHeaderProps) => (
<div
class={cx(
"flex items-center gap-3 rounded-md px-3 py-2",
variantColorsMap[props.variant]
variantColorsMap[props.variant],
)}
>
{

View File

@@ -132,7 +132,7 @@ export const InputLabel = (props: InputLabelProps) => {
{props.required && (
<Typography
class="inline-flex px-1 align-text-top leading-[0.5] fg-def-4"
useExternColor={true}
color="inherit"
hierarchy="label"
weight="bold"
size="xs"