diff --git a/src/frontend/packages/lib_components/src/common/Text/Text/index.tsx b/src/frontend/packages/lib_components/src/common/Text/Text/index.tsx index 91eed5d071..0b902f4572 100644 --- a/src/frontend/packages/lib_components/src/common/Text/Text/index.tsx +++ b/src/frontend/packages/lib_components/src/common/Text/Text/index.tsx @@ -1,10 +1,7 @@ +import { Maybe } from 'lib-common'; import { ReactHTML } from 'react'; -import { - ObtainHTMLProps, - Typo, - TypoPropsOnly, -} from '@lib-components/common/Typo'; +import { Typo, TypoProps } from '@lib-components/common/Typo'; export const TextWeights = { black: 'fw-black', @@ -25,15 +22,24 @@ export const TextSizes = { tiny: 'fs-t', } as const; -export interface TextPropsOnly extends TypoPropsOnly { +export interface TextPropsOnly { size?: keyof typeof TextSizes; weight?: keyof typeof TextWeights; } type TextTypes = Pick; -export type TextProps = TextPropsOnly & - ObtainHTMLProps; +/** + * @description Typo props + * @param T - keyof TextTypes + * @example + * type Props = TextProps<'div'>; + * // type Props = ReactHTMLInfer
& TextPropsOnly & TypoPropsOnly & HTMLAttributes + */ +export type TextProps> = TypoProps< + T, + TextPropsOnly +>; /** * @param TextPropsOnly - @@ -43,7 +49,7 @@ export type TextProps = TextPropsOnly & * @See {@link Typo } * @returns Text component */ -export const Text = ({ +export const Text = >({ className, size = 'medium-large', type = 'span',