Skip to content
Merged
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
42 changes: 42 additions & 0 deletions public/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}
67 changes: 67 additions & 0 deletions public/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import { SignInButton, SignUpButton, LogOutButton } from './components/auth/Button'
import { SignInForm, SignUpForm } from './components/auth/Input'
import { useAuth } from './context/AuthContext'
import { doSignOut } from './firebase/auth'

function App() {
const [count, setCount] = useState(0)
const [isSignInOpen, setIsSignInOpen] = useState(false)
const [isSignUpOpen, setIsSignUpOpen] = useState(false)
const { userLoggedIn } = useAuth()

const openSignIn = () => setIsSignInOpen(true)
const closeSignIn = () => setIsSignInOpen(false)
const openSignUp = () => setIsSignUpOpen(true)
const closeSignUp = () => setIsSignUpOpen(false)

const handleLogout = async () => {
try {
await doSignOut()
} catch (error) {
console.error('Logout error:', error)
}
}

return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.jsx</code> and save to test HMR
</p>
</div>

{!userLoggedIn ? (
<>
<SignInButton onClick={openSignIn} />
<SignUpButton onClick={openSignUp} />
</>
) : (
<LogOutButton onClick={handleLogout} />
)}

<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
<SignInForm isOpen={isSignInOpen} onClose={closeSignIn} />
<SignUpForm isOpen={isSignUpOpen} onClose={closeSignUp} />
</>
)
}

export default App
12 changes: 12 additions & 0 deletions public/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions public/components/auth/Button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { doSignOut } from '../../firebase/auth';

// Authentication buttons component - Sign in and sign up trigger buttons
// TODO: Implement button variants and styling

function SignInButton({ onClick }) {
return (
<button onClick={onClick}>Sign In</button>
)
}

function SignUpButton({ onClick }) {
return (
<button onClick={onClick}>Sign Up</button>
)
}

function LogOutButton({ onClick }) {
return (
<button onClick={onClick}>Log Out</button>
)
}

export { SignInButton, SignUpButton, LogOutButton }
Loading