Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

feat: added github sign in #282

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/components/SignIn/Social.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import { FaGithub, FaGoogle } from 'react-icons/fa';
import { supabase } from '../../utils/supabaseClient';
import { FaGithub } from 'react-icons/fa';

export function SignInSocial() {
const handleGitHubSignIn = async () => {
const { error } = await supabase.auth.signIn({
provider: 'github',
});
if (error) alert(error.message);
};

return (
<div className='mt-6'>
<p className='text-sm text-gray-700'>Sign in with</p>
<div className='my-2 grid grid-cols-2 gap-4'>
<div>
{/* <div>
<a
href='#'
className='inline-flex w-full justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-500 shadow-sm hover:bg-gray-50'
>
<span className='sr-only'>Sign in with Google</span>
<FaGoogle className='text-xl text-gray-500' />
</a>
</div>
</div> */}

<div>
<a
href='#'
<button
onClick={handleGitHubSignIn}
className='inline-flex w-full justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-500 shadow-sm hover:bg-gray-50'
>
<span className='sr-only'>Sign in with GitHub</span>
<FaGithub className='text-xl text-gray-500' />
</a>
</button>
</div>
</div>
<div className='relative mt-6'>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Image from 'next/future/image';
import Head from 'next/head';
import Link from 'next/link';
import { SignInForm } from '../components/SignIn/Form';
import { SignInSocial } from '../components/SignIn/Social';
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import type { PageProps } from '../lib/types';
Expand Down Expand Up @@ -30,7 +31,7 @@ export default function SignIn({ user }: PageProps) {
<h2 className='mt-6 text-start text-3xl font-bold tracking-tight text-gray-900'>Sign in</h2>
</div>
{/* TODO: social sign in options */}
{/* <SignInSocial /> */}
<SignInSocial />
<SignInForm />
<p className='my-2 flex w-full justify-center text-sm text-gray-700'>
Not registered yet?{' '}
Expand Down