import React from 'react' import { linkClasses } from '@freesewing/utils' /** * An anchor link component * * @component * @param {object} props - All component props * @param {JSX.Element} props.children - The component children, will be rendered inside the link * @param {string} [props.id = ''] - The ID of the anchor to link to * @param {string} [props.title = false] - An optional link title * @returns {JSX.Element} */ export const AnchorLink = ({ children, id = '', title = false }) => ( {children} ) /** * A regular link component * * @component * @param {object} props - All component props * @param {JSX.Element} props.children - The component children, will be rendered inside the link * @param {string} [props.className = @freesewing/utils/linkClasses] - Any non-default CSS classes to apply * @param {string} props.href - The URL to link to * @param {object} [props.style = {}] - Any non-default styles to apply * @param {string} [props.target = undefined] - An optional link title * @param {string} [props.title = false] - An optional link title * @returns {JSX.Element} */ export const Link = ({ children, className = linkClasses, href, style = {}, target, title = false, }) => ( {children} ) const BaseLink = Link /** * A regular link, but intended to be used on a success background * * @component * @param {object} props - All component props * @param {JSX.Element} props.children - The component children, will be rendered inside the link * @param {string} props.href - The URL to link to * @param {string} [props.title = false] - An optional link title * @param {React.FC} [Link = undefined] - An optional framework-specific Link component * @returns {JSX.Element} */ export const SuccessLink = ({ children, href, title = false, Link }) => Link ? ( {children} ) : ( {children} ) /** * A link styled as a card * * @component * @param {object} props - All component props * @param {JSX.Element} props.children - The component children, will be rendered inside the link * @param {string} [props.className = @freesewing/utils/linkClasses + "tw:text-success-content tw:hover:text-success-content"] - Any non-default CSS classes to apply * @param {string} props.href - The URL to link to * @param {string} [props.title = false] - An optional link title * @param {JSX.Element} props.icon - An icon to render * @param {React.FC} [Link = undefined] - An optional framework-specific Link component * @returns {JSX.Element} */ export const CardLink = ({ children, className = 'tw:bg-base-200 tw:text-base-content', href, title, icon, Link, }) => { if (!Link) Link = BaseLink return (

{title} {icon}

{children}
) }