added things

This commit is contained in:
LucasLassiter
2022-05-03 22:00:45 -07:00
parent 455ab524fa
commit fb28b8380d
10 changed files with 620 additions and 1064 deletions

View File

@@ -1,8 +1,15 @@
import '../styles/globals.css'
import Navbar from '../components/Navbar';
import { Toaster } from 'react-hot-toast';
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
return (
<>
<Navbar />
<Component {...pageProps} />
<Toaster />
</>
);
}
export default MyApp

View File

@@ -1,7 +1,41 @@
import { auth, googleAuthProvider } from '../lib/firebase';
export default function EnterPage({ }) {
const user = null
const username = null;
// 1. user signed out <SignInButton />
// 2. user signed in, but missing username <UsernameForm />
// 3. user signed in, has username <SignOutButton />
return (
<main>
<h1>Sign Up</h1>
{user ?
!username ? <UsernameForm /> : <SignOutButton />
:
<SignInButton />
}
</main>
)
}
// Sign in with Google button
function SignInButton() {
const signInWithGoogle = async () => {
await auth.signInWithPopup(googleAuthProvider);
};
return (
<button className="btn-google" onClick={signInWithGoogle}>
<img src={'/google.png'} /> Sign in with Google
</button>
);
}
function SignOutButton() {
return <button onClick={() => auth.signOut()}>Sign Out</button>
}
function UsernameForm() {
}

View File

@@ -1,11 +1,18 @@
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import Head from 'next/head';
import Image from 'next/image';
import styles from '../styles/Home.module.css';
import Loader from '../components/Loader';
import toast from 'react-hot-toast';
export default function Home() {
return (
<div>
<h1>Hello world!</h1>
<Loader show />
<button onClick={() => toast.success('hello toast!')}>
Click for Toast!
</button>
</div>
)
}