import { IconProps } from '../icon/Icon'; import { AnchorHTMLAttributes, ButtonHTMLAttributes, MouseEvent } from 'react'; export interface LinkIcon extends Pick { /** Position of the icon in relation to the text */ position: 'left' | 'right'; } export type LinkColor = 'primary' | 'secondary' | 'tertiary'; interface BaseProps { /** Text displayed */ children: string; /** If provided, alters the text-color */ feColor?: LinkColor; /** If provided, renders an icon before or after the text */ feIcon?: LinkIcon; /** If true, fills the parents horizontal axis */ feStretch?: boolean; /** Custom onClick where the second return parameter enables custom routing */ onClick?: (event: MouseEvent, route: string) => void; } export interface LinkAnchor extends Omit, 'children' | 'onClick'>, BaseProps { /** Option to render the component as a button. Rendered as a link by default */ as: 'a'; href: string; } export interface LinkButton extends Omit, 'children' | 'onClick'>, BaseProps { as: 'button'; /** Custom route which is used together with onClick */ route?: string; } export type LinkProps = LinkAnchor | LinkButton; /** * The `` component renders a link as an anchor or button element. **Notice!** Be careful to choose the appropriate type.
* It extends the interface of native `` and `