import { useStyleConfig, vui } from '../core'
import T, { TProps } from '../t'
import { cs } from '../utils'
import { useLinkContext } from './context'

/** Displays text of the Link. */
export const LinkText = vui<'span', TProps>((props, ref) => {
  const { className, ...rest } = props
  const styles = useStyleConfig('Link', useLinkContext())

  return (
    <T
      className={cs('vui-linkText', className)}
      fontSize="inherit"
      ref={ref}
      transitionDuration="unset"
      {...styles.text}
      {...rest}
    />
  )
})

LinkText.displayName = 'LinkText'
export default LinkText
