ReviewButton.tsx 903 B

1234567891011121314151617181920212223242526
  1. import { IS_GUEST } from "@utils/constants";
  2. import { getCookie } from "@utils/cookie-tools";
  3. import { useRouter } from "next/navigation";
  4. export const ReviewButton = ({ setShowForm, className }: { setShowForm: () => void, className?: string }) => {
  5. const IsGuest = getCookie(IS_GUEST);
  6. const router = useRouter();
  7. const handleAddReview = () => {
  8. if (IsGuest === "true" || IsGuest === null) {
  9. setShowForm();
  10. // router.push("/customer/login");
  11. } else {
  12. setShowForm();
  13. }
  14. };
  15. return (
  16. <button
  17. onClick={handleAddReview}
  18. className={`relative flex font-normal text-ly-14 leading-ly-24 text-[#1E3932FF] py-1 px-3.5 cursor-pointer h-fit items-center justify-center rounded-full bg-[#E1E8E6FF] p-4 tracking-wide mt-4 ${className}`}
  19. >
  20. Write a review
  21. </button>
  22. )
  23. }