import * as React from 'react';
import { type UrlObject } from 'url';
import Link from 'next/link';
import clsx from 'clsx';
import { Tooltip } from './Tooltip';
import { classes } from './IconButton';
export function IconLinkButton(props: IconLinkButton.Props) {
const { size = 1, useNextLink, label, withTooltip, ...other } = props;
const link = useNextLink ? (
)}
className={clsx(classes.root, classes[`s-${size}`], props.className)}
/>
) : (
)}
className={clsx(classes.root, classes[`s-${size}`], props.className)}
/>
);
if (withTooltip) {
return {link};
}
return link;
}
export namespace IconLinkButton {
export type Props = Omit, 'href'> & {
size?: 1 | 2 | 3;
label: string;
withTooltip?: boolean;
} & (
| {
useNextLink?: false;
href?: string;
}
| {
useNextLink: true;
href: string | UrlObject;
}
);
}