import styles from "./styles.module.scss";
import { navigateToAuth } from "@/utils/auth-navigation";

interface IAlreadyHaveAccountProps {
  text?: string;
}

function AlreadyHaveAccount({ text }: IAlreadyHaveAccountProps) {
  const navigateAuth = () => {
    // Use server-side navigation to ensure redirects work properly
    navigateToAuth(undefined, true);
  };
  return (
    <button className={styles["have-account"]} onClick={navigateAuth}>
      {text?.length ? text : "Already have an account? Sign in"}
    </button>
  );
}

export default AlreadyHaveAccount;
