32 lines
841 B
TypeScript
32 lines
841 B
TypeScript
import { cls } from "@/lib/utils";
|
|
|
|
interface ButtonProps {
|
|
text: string;
|
|
variant?: "primary" | "secondary";
|
|
href?: string;
|
|
onClick?: () => void;
|
|
animate?: boolean;
|
|
animationDelay?: number;
|
|
className?: string;
|
|
}
|
|
|
|
const Button = ({ text, variant = "primary", href, onClick, className }: ButtonProps) => {
|
|
const baseClass = variant === "primary" ? "primary-button text-primary-cta-text" : "secondary-button text-secondary-cta-text";
|
|
const classes = cls("inline-flex items-center justify-center px-5 py-3 text-sm rounded cursor-pointer transition-all", baseClass, className);
|
|
|
|
if (href) {
|
|
return (
|
|
<a href={href} className={classes} onClick={onClick}>
|
|
{text}
|
|
</a>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<button onClick={onClick} className={classes}>
|
|
{text}
|
|
</button>
|
|
);
|
|
};
|
|
|
|
export default Button; |