forked from Ujjalzaman/Easy-Consulting-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
ba02b13
commit d594776
Showing
6 changed files
with
102 additions
and
27 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 |
---|---|---|
|
@@ -31,16 +31,16 @@ const SignInForm = ({handleResponse}) => { | |
}) | ||
} | ||
return ( | ||
<form onSubmit={handleSubmit(onSubmit)} class="sign-in-form"> | ||
<form onSubmit={handleSubmit(onSubmit)} className="sign-in-form"> | ||
<Toast show={show} onClose={() => setShow(!show)} className="signInToast"> | ||
<Toast.Header> | ||
<img src={`${ifoIcon}`} className="circle mr-2 toastIcon" alt=""/> | ||
<strong className="mr-auto">Important Info</strong> | ||
</Toast.Header> | ||
<Toast.Body>Use this account to sign in as a admin, to test admin panel. Sign in with different account as a user</Toast.Body> | ||
</Toast> | ||
<h2 class="title">Sign in</h2> | ||
<div class="input-field"> | ||
<h2 className="title">Sign in</h2> | ||
<div className="input-field"> | ||
<span className="fIcon"><FontAwesomeIcon icon={faEnvelope}/></span> | ||
<input defaultValue='[email protected]' placeholder="Email" {...register("email", { required: true })} /> | ||
</div> | ||
|
@@ -51,7 +51,7 @@ const SignInForm = ({handleResponse}) => { | |
</div> | ||
{errors.password && <span className="text-warning">This field is required</span>} | ||
<input className="iBtn" type="submit" value="sign In"/> | ||
<p class="social-text">Or Sign in with social platforms</p> | ||
<p className="social-text">Or Sign in with social platforms</p> | ||
<SocialMedia handleResponse={handleResponse}/> | ||
</form> | ||
); | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.popImg { | ||
height: 45px; | ||
border-radius: 50%; | ||
cursor: pointer!important; | ||
margin: 0.2rem 0 0 0.7rem; | ||
} | ||
.popUserImg { | ||
height: 60px; | ||
border-radius: 50%; | ||
margin-bottom: 8px; | ||
} | ||
.userName, | ||
.userEmail{ | ||
margin-bottom: 0; | ||
font-size: 1rem; | ||
font-weight: 700; | ||
} | ||
.userEmail { | ||
margin: 0.1rem 0 0.5rem; | ||
font-weight: 600; | ||
font-size: 0.9rem; | ||
color: rgba(0,0,0,.7); | ||
} |
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,52 @@ | ||
import React, { useContext } from 'react'; | ||
import { useState } from 'react'; | ||
import { useRef } from 'react'; | ||
import { Button, Overlay } from 'react-bootstrap'; | ||
import Popover from 'react-bootstrap/Popover' | ||
import './PopOver.css'; | ||
import toast from 'react-hot-toast'; | ||
import { UserContext } from '../../../App'; | ||
import { handleSignOut } from '../../Login/LoginManager'; | ||
|
||
const PopOver = () => { | ||
const { user: {name,email, img}, setUser} = useContext(UserContext); | ||
const [show, setShow] = useState(false); | ||
const [target, setTarget] = useState(null); | ||
const ref = useRef(null); | ||
const handleClick = (event) => { | ||
setShow(!show); | ||
setTarget(event.target); | ||
}; | ||
const signOut = () => { | ||
const loading = toast.loading('Please wait...'); | ||
handleSignOut() | ||
.then(res => { | ||
toast.dismiss(loading); | ||
setUser(res) | ||
toast.error('Logged Out!'); | ||
}) | ||
} | ||
return ( | ||
<div ref={ref}> | ||
<img src={img} alt="" onClick={handleClick} className="popImg"/> | ||
<Overlay | ||
show={show} | ||
target={target} | ||
placement="bottom" | ||
container={ref.current} | ||
containerPadding={50} | ||
> | ||
<Popover id="popover-contained"> | ||
<Popover.Content className="text-center"> | ||
<img src={img} alt="" className="popUserImg"/> | ||
<p className="userName">{`${name}`}</p> | ||
<p className="userEmail">{email}</p> | ||
<Button variant="outline-danger" size="sm" onClick={signOut}>Log out</Button> | ||
</Popover.Content> | ||
</Popover> | ||
</Overlay> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PopOver; |