I'm trying to assign static properties to components, and I've tried every way imaginable, but nothing seems to work.
Minimal example:
'use client';
export interface LinkProps
extends Pick<
ButtonProps,
| 'variant'
| 'color'
| 'size'
| 'startIcon'
| 'endIcon'
| 'loadingIndicator'
| 'loading'
| 'tooltip'
| 'tooltipProps'
| 'disabled'
| 'children'
| 'className'
>,
Omit<LinkPrimitiveProps, 'href'>,
Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'target' | 'rel'> {
href: string | UrlObject;
const LinkComponent: React.FC<LinkProps> = ({
children,
href,
color,
variant,
...props
}) => {
return (
<NextLink href={href} {...props}>
{children}
</NextLink>
);
};
/**
* Attach the static properties to the Button component.
*/
const Link = Object.assign(LinkComponent, {
Colors,
Sizes,
Variants
});
export { Link };
Should be able to do this
<Link
color={Link.Colors.RED}
variant={Link.Variants.FILL}
href={href}
>
Hello
</Link>