Files
guru_sainath e3445988fb chore: Google and Github integration (#1546)
* fix: Google auth for mobile and clear out the session in mobile auth

* fix: github and google auth cleanup
2024-10-17 19:55:56 +05:30

43 lines
1.2 KiB
TypeScript

"use client";
import { FC } from "react";
import Image from "next/image";
import { useTheme } from "next-themes";
// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
// images
import githubLightModeImage from "/public/logos/github-black.png";
import githubDarkModeImage from "/public/logos/github-dark.svg";
export type TGitHubAuthButton = {
title: string;
};
export const GitHubAuthButton: FC<TGitHubAuthButton> = (props) => {
// props
const { title } = props;
// hooks
const { resolvedTheme } = useTheme();
const handleSignIn = () => {
window.location.assign(`${API_BASE_URL}/auth/mobile/github/`);
};
return (
<button
className={`flex h-[42px] w-full items-center justify-center gap-2 rounded border px-2 text-sm font-medium text-custom-text-100 duration-300 bg-onboarding-background-200 hover:bg-onboarding-background-300 ${
resolvedTheme === "dark" ? "border-[#43484F]" : "border-[#D9E4FF]"
}`}
onClick={handleSignIn}
>
<Image
src={resolvedTheme === "dark" ? githubDarkModeImage : githubLightModeImage}
height={20}
width={20}
alt="GitHub Logo"
/>
{title}
</button>
);
};