import GradientButton from '@/Component/Common/Forms/GradientButton';
import PrimaryButton from '@/Component/Common/Forms/PrimaryButton';
import { useRouter } from 'next/navigation';

const HOCButton = (props: any) => {
    const { btnProps, buttonRequired = true } = props
    const router = useRouter();

    const clickHandle = () => {
        btnProps?.path && router.push(btnProps?.path)
    }
    return (
        <>
            {
                buttonRequired ?
                    <PrimaryButton onClick={btnProps?.callBack ? btnProps?.callBack : clickHandle} customClass={'ml-2 flex justify-center items-center max-w-40 !rounded-3xl'}>
                        {btnProps?.icon ? btnProps?.icon : ""}
                        {btnProps?.title}
                    </PrimaryButton> :
                    null
            }
        </>
    )
}

export default HOCButton;
