Skip to content

Commit 974aaa1

Browse files
fix(ui): improve prop handling in RichText component
1 parent f7f7dec commit 974aaa1

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/ui/src/components/RichText/RichText.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,27 @@ const LinkComp: FC<Readonly<LinkProps & { children: ReactNode; className?: strin
2020

2121
const TypographyComp: FC<Readonly<TypographyProps & { children: ReactNode; tag: string }>> = ({
2222
children,
23+
tag = 'p',
24+
variant,
2325
...props
2426
}) => {
25-
const Tag = props.tag || 'p';
27+
const Tag = tag || 'p';
2628
return (
27-
<Typography variant={props.variant} asChild>
29+
<Typography variant={variant} asChild>
2830
<Tag {...props}>{children}</Tag>
2931
</Typography>
3032
);
3133
};
3234

3335
const TdComp: FC<Readonly<TypographyProps & { children: ReactNode }>> = ({
3436
children,
37+
'data-highlighted': isHighlighted,
3538
...props
3639
}: {
3740
children: ReactNode;
3841
'data-highlighted'?: boolean;
3942
}) => {
40-
const variant = props['data-highlighted'] ? 'tableCellHighlighted' : 'tableCell';
43+
const variant = isHighlighted ? 'tableCellHighlighted' : 'tableCell';
4144
return (
4245
<TypographyComp variant={variant} tag="td" {...props}>
4346
{children}

0 commit comments

Comments
 (0)