import { forwardRef, type AnchorHTMLAttributes, type ForwardedRef } from 'react'
import {
getTextLinkProps,
getIconProps,
splitClassNameProp,
} from '@pluralsight/headless-styles'
import type { TextLinkOptions } from '@pluralsight/headless-styles/types'
import { ExternalLinkIcon } from '@pluralsight/icons'
interface TextLinkProps
extends TextLinkOptions,
AnchorHTMLAttributes {}
function TextLinkEl(
props: TextLinkProps,
ref: ForwardedRef
) {
const { children, ...nativeProps } = props
const { link, iconOptions } = getTextLinkProps({
classNames: splitClassNameProp(nativeProps.className),
href: props.href ?? '',
})
return (
{children}
{iconOptions && }
)
}
export const TextLink = forwardRef(TextLinkEl)