import { useStyleConfig, vui } from '../core'
import Icon, { IconProps } from '../icon'
import { cs } from '../utils'
import { useLinkContext } from './context'

/** Displays an icon within the Link. */
export const LinkIcon = vui<'svg', IconProps>((props, ref) => {
  const { className, ...rest } = props
  const styles = useStyleConfig('Link', useLinkContext())

  return <Icon className={cs('vui-linkIcon', className)} ref={ref} {...styles.icon} {...rest} />
})

LinkIcon.displayName = 'LinkIcon'

export default LinkIcon
