Files
nextjs/app/components/PrimaryButton.tsx
2024-12-16 13:30:44 +05:30

35 lines
722 B
TypeScript

"use client";
import React from "react";
interface ButtonProps {
type?: "button" | "submit" | "reset";
children: React.ReactNode;
onClick?: () => void;
className?: string;
disabled?: boolean;
isLoading?:boolean
}
const Button: React.FC<ButtonProps> = ({
type = "button",
children,
onClick,
className = "",
disabled = false,
isLoading
}) => {
return (
<button
type={type}
onClick={onClick}
disabled={disabled}
className={`w-full bg-pink-600 text-white py-2 rounded-lg hover:bg-pink-700 flex align-middle justify-center transition duration-300 ${className} `}
>
{isLoading?<span className="loading"/>: children}
</button>
);
};
export default Button;