import React, { FC, ComponentProps } from 'react'
import { Typography, TypographyProps } from 'antd'
import styled from 'styled-components'

type TextProps = ComponentProps<TypographyProps['Text']> & {
	primary?: boolean
	inherit?: boolean
}

const StyledText = styled(Typography.Text)<{
	$inherit?: boolean
	$primary?: boolean
}>`
  ${({ $inherit }) => $inherit ? 'font-size: inherit;line-height:inherit;' : ''}
  ${({ $primary, theme }) => $primary ? `color: ${theme.brandPrimary}` : ''}
`
export const Text: FC<TextProps> = ({ primary, inherit, ...props }) => {
	return <StyledText {...props} $primary={primary} $inherit={inherit} />
}
