fix(ssr): remove a tag on button

This commit is contained in:
Lee 2023-11-08 08:49:15 +00:00
parent fb38ac69df
commit e40c78e9b9

@ -3,38 +3,38 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/Tooltip";
interface ButtonProps { interface ButtonProps {
text?: JSX.Element | string; text?: JSX.Element | string;
url?: string;
icon?: JSX.Element; icon?: JSX.Element;
color?: string; color?: string;
tooltip?: React.ReactNode; tooltip?: React.ReactNode;
className?: string; className?: string;
ariaLabel?: string;
onClick?: () => void; onClick?: () => void;
} }
export default function Button({ export default function Button({
text, text,
url,
icon, icon,
color, color,
tooltip, tooltip,
className, className,
ariaLabel = "Default button label",
onClick, onClick,
}: ButtonProps) { }: ButtonProps) {
if (!color) color = "bg-blue-500"; if (!color) color = "bg-blue-500";
const base = ( const base = (
<a href={url} onClick={onClick}> <button
<p className={clsx(
className={clsx( "flex items-center justify-center gap-2 rounded-md px-4 py-2",
"font-md flex w-fit transform-gpu flex-row items-center gap-1 rounded-md p-1 transition-all hover:opacity-80", color,
className, className,
color, )}
)} onClick={onClick}
> aria-label={ariaLabel}
{icon} >
{text} {icon}
</p> {text}
</a> </button>
); );
if (tooltip) { if (tooltip) {