forked from infoshareacademy/jfdzr12-project-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7ac6f7
commit ce9b206
Showing
11 changed files
with
340 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { getFirestore } from 'firebase/firestore' | ||
import { getFirestore } from "firebase/firestore"; | ||
import { initializeApp } from "firebase/app"; | ||
|
||
import { getStorage } from "firebase/storage"; | ||
import { getAuth } from "firebase/auth"; | ||
|
||
export const firebaseConfig = { | ||
apiKey: import.meta.env.VITE_FIREBASE_API_KEY, | ||
authDomain: import.meta.env.VITE_AUTH_DOMAIN, | ||
projectId: import.meta.env.VITE_PROJECT_ID, | ||
storageBucket: import.meta.env.VITE_STORAGE_BUCKET, | ||
messagingSenderId: import.meta.env.VITE_FIREBASE_MSG_SENDER_ID, | ||
appId: import.meta.env.VITE_FIREBASE_APP_ID | ||
apiKey: import.meta.env.VITE_FIREBASE_API_KEY, | ||
authDomain: import.meta.env.VITE_AUTH_DOMAIN, | ||
projectId: import.meta.env.VITE_PROJECT_ID, | ||
storageBucket: import.meta.env.VITE_STORAGE_BUCKET, | ||
messagingSenderId: import.meta.env.VITE_FIREBASE_MSG_SENDER_ID, | ||
appId: import.meta.env.VITE_FIREBASE_APP_ID, | ||
}; | ||
|
||
const app = initializeApp(firebaseConfig); | ||
export const db = getFirestore(app); | ||
export const auth = getAuth(app); | ||
export const storage = getStorage(app); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
my-app/src/Components/Authentication/Login/Login.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.login__container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.login__header { | ||
margin: 100px auto 80px; | ||
text-align: center; | ||
font-family: "Arial Rounded MT Bold", "Helvetica Rounded", Arial, sans-serif; | ||
font-weight: 800; | ||
text-transform: uppercase; | ||
font-size: 2.4rem; | ||
} | ||
|
||
.login__form { | ||
height: 500px; | ||
width: 500px; | ||
border-radius: 20px; | ||
padding-bottom: 20px; | ||
} | ||
|
||
.light { | ||
background: var(--box-light-color-light); | ||
color: var(--main-text-color-light); | ||
} | ||
|
||
.dark { | ||
background: var(--box-light-color-dark); | ||
color: var(--main-text-color-dark); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import styles from "./Login.module.css" | ||
import { ThemeContext } from "../../../providers/theme.tsx"; | ||
import { useContext } from "react"; | ||
import classnames from "classnames"; | ||
import { AuthForm } from "../../structure_components/AuthForm.jsx" | ||
import { useNavigate } from "react-router-dom"; | ||
import { signInWithEmailAndPassword } from "firebase/auth"; | ||
import { auth } from "../../../../firebase-config.js"; | ||
|
||
|
||
export const Login = () => { | ||
const { theme } = useContext(ThemeContext); | ||
const navigate = useNavigate() | ||
const handleSubmit = ({ login, password }) => { | ||
signInWithEmailAndPassword(auth, login, password) | ||
.then((e) => console.log(e)) | ||
.then(() => navigate("/")) | ||
} | ||
return ( | ||
<div className={classnames(styles["login__container"], styles[theme])}> | ||
<h1 className={classnames(styles["login__header"], styles[theme])}> | ||
Login page | ||
</h1> | ||
<div className={classnames(styles["login__form"], styles[theme])}> | ||
|
||
<AuthForm submitText="Login" handleSubmit={handleSubmit}></AuthForm> | ||
</div> | ||
|
||
</div> | ||
); | ||
}; |
32 changes: 32 additions & 0 deletions
32
my-app/src/Components/Authentication/Register/Register.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.register__container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.register__header { | ||
margin: 100px auto 80px; | ||
text-align: center; | ||
font-family: "Arial Rounded MT Bold", "Helvetica Rounded", Arial, sans-serif; | ||
font-weight: 800; | ||
text-transform: uppercase; | ||
font-size: 2.4rem; | ||
} | ||
|
||
.register__form { | ||
height: 500px; | ||
width: 500px; | ||
border-radius: 20px; | ||
padding-bottom: 20px; | ||
} | ||
|
||
.light { | ||
background: var(--box-light-color-light); | ||
color: var(--main-text-color-light); | ||
} | ||
|
||
.dark { | ||
background: var(--box-light-color-dark); | ||
color: var(--main-text-color-dark); | ||
} |
27 changes: 27 additions & 0 deletions
27
my-app/src/Components/Authentication/Register/Register.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import styles from "./Register.module.css" | ||
import { ThemeContext } from "../../../providers/theme.tsx"; | ||
import { useContext } from "react"; | ||
import classnames from "classnames"; | ||
import { AuthForm } from "../../structure_components/AuthForm.jsx" | ||
import { createUserWithEmailAndPassword } from "firebase/auth"; | ||
import { auth } from "../../../../firebase-config.js"; | ||
|
||
|
||
export const Register = () => { | ||
const { theme } = useContext(ThemeContext); | ||
const handleSubmit = ({ login, password }) => { | ||
createUserWithEmailAndPassword(auth, login, password) | ||
.then((e) => console.log(e)) | ||
} | ||
return ( | ||
<div className={classnames(styles["register__container"], styles[theme])}> | ||
<h1 className={classnames(styles["register__header"], styles[theme])}> | ||
Registration page | ||
</h1> | ||
<div className={classnames(styles["register__form"], styles[theme])}> | ||
<AuthForm submitText="Register" handleSubmit={handleSubmit}></AuthForm> | ||
</div> | ||
|
||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.