import React, { forwardRef } from 'react' import { Link as RACLink, type LinkProps as RACLinkProps } from 'react-aria-components' import { type ButtonUIProps } from '~components/Button' import { ButtonContent } from '~components/Button/subcomponents' import { useReversedColors } from '~components/utils' import { mergeClassNames } from '~components/utils/mergeClassNames' import buttonStyles from '../Button/Button.module.css' import styles from './LinkButton.module.css' export type LinkButtonProps = ButtonUIProps & Omit & { /** Used as the label for the LinkButton. */ children: RACLinkProps['children'] } export const LinkButton = forwardRef( ( { children, variant = 'primary', size = 'medium', icon, iconPosition = 'start', hasHiddenLabel = false, isFullWidth = false, isDisabled, className, ...otherProps }: LinkButtonProps, ref: React.ForwardedRef, ) => { const isReversedVariant = useReversedColors() return ( {(racStateProps) => { const childIsFunction = typeof children === 'function' return ( {childIsFunction ? children(racStateProps) : children} ) }} ) }, ) LinkButton.displayName = 'LinkButton'