-
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
gehiv
committed
Jun 15, 2024
1 parent
5eb53ca
commit f8675db
Showing
5 changed files
with
177 additions
and
127 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,2 +1,2 @@ | ||
vite.svg,1713955457734,59ec4b6085a0cb1bf712a5e48dd5f35b08e34830d49c2026c18241be04e05d5a | ||
index.html,1718465250528,8e66b0905c08b14c069e3f9b1b867fafd21e64ef3c62bb98da65a79adcd9e3d0 | ||
vite.svg,1713955457734,59ec4b6085a0cb1bf712a5e48dd5f35b08e34830d49c2026c18241be04e05d5a |
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,10 +1,7 @@ | ||
rules_version = '2'; | ||
|
||
service cloud.firestore { | ||
match /databases/{database}/documents { | ||
match /{document=**} { | ||
allow read, write: if true; | ||
} | ||
|
||
allow read, write: if request.auth != null; | ||
} | ||
} | ||
} |
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
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,40 +1,77 @@ | ||
|
||
import { useNavigate } from 'react-router-dom'; | ||
import { signInWithPopup, GoogleAuthProvider } from 'firebase/auth'; | ||
import { auth } from '../firebase'; | ||
|
||
function Login() { | ||
const navigate=useNavigate(); | ||
const navigate = useNavigate(); | ||
|
||
const handleGoogle = async (e) => { | ||
e.preventDefault(); | ||
try { | ||
const provider = new GoogleAuthProvider(); | ||
const result = await signInWithPopup(auth, provider); | ||
console.log(result); | ||
navigate('/blogs') | ||
navigate('/blogs'); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
} | ||
|
||
return ( | ||
<div className="text-center" style={{position:"relative",top:"30vh" ,left:"30vw"}}> | ||
<button | ||
className="d-flex align-items-center my-5 text-center" style={{backgroundColor:"white",width:"29%" ,justifyConten:"center", gap:"5%",alignItem:"center"}} | ||
onClick={handleGoogle}> | ||
<div style={{width:"14%"}}> | ||
<img | ||
src="https://freelogopng.com/images/all_img/1657955079google-icon-png.png" | ||
alt="" | ||
style={{ width: "100%" }} | ||
/> | ||
</div> | ||
<div> | ||
{" "} | ||
<h2 style={{fontWeight:"bold",color:"linear-gradient(90deg, #0b131b, #010f1b)"}}>Login with Google</h2> | ||
</div> | ||
</button> | ||
<div style={styles.container}> | ||
<button onClick={handleGoogle} style={styles.button}> | ||
<div style={styles.iconContainer}> | ||
<img | ||
src="https://freelogopng.com/images/all_img/1657955079google-icon-png.png" | ||
alt="Google icon" | ||
style={styles.icon} | ||
/> | ||
</div> | ||
<div style={styles.textContainer}> | ||
<h2 style={styles.text}>Login with Google</h2> | ||
</div> | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
const styles = { | ||
container: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
height: '100vh', | ||
}, | ||
button: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
backgroundColor: 'white', | ||
padding: '10px 20px', | ||
border: '2px solid #0b131b', | ||
borderRadius: '8px', | ||
cursor: 'pointer', | ||
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)', | ||
transition: 'all 0.3s ease', | ||
}, | ||
iconContainer: { | ||
width: '30px', | ||
marginRight: '10px', | ||
}, | ||
icon: { | ||
width: '100%', | ||
}, | ||
textContainer: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
}, | ||
text: { | ||
fontWeight: 'bold', | ||
background: 'linear-gradient(90deg, #0b131b, #010f1b)', | ||
WebkitBackgroundClip: 'text', | ||
WebkitTextFillColor: 'transparent', | ||
margin: 0, | ||
}, | ||
}; | ||
|
||
export default Login; |
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