Skip to content

Commit

Permalink
Feat:add login modal fixes #42
Browse files Browse the repository at this point in the history
sign in with facebook and google modal
  • Loading branch information
klay964 committed Mar 28, 2021
1 parent c637062 commit 669bb47
Show file tree
Hide file tree
Showing 12 changed files with 270 additions and 40 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"i18next-browser-languagedetector": "^6.0.1",
"i18next-http-backend": "^1.1.1",
"prettier": "^2.2.1",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-bootstrap": "^1.5.2",
"react-dom": "^17.0.1",
Expand Down
42 changes: 9 additions & 33 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
.App {
text-align: center;
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
.btn:focus,
.btn:active,
.btn:hover,
.btn {
outline: none !important;
box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.background-facebook {
background-color: #4267b2;
}
1 change: 1 addition & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SIGNUP_ROUTE,
CONTACT_US_ROUTE,
} from './routes'
import './App.css'

function App() {
return (
Expand Down
21 changes: 21 additions & 0 deletions src/components/Modals/Login/Login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.bg-modal-login {
background-image: url('../../../images/login/bg-modal.svg');
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}

@media (max-width: 522px) {
.bg-modal-login {
background-image: url('../../../images/login/bg-modal.svg');
background-repeat: no-repeat;
background-position: right;
background-size: cover;
}
.bg-modal-login-2 {
background-image: url('../../../images/login/bg-modal.svg');
background-repeat: no-repeat;
background-position: 15% 15%;
background-size: cover;
}
}
74 changes: 74 additions & 0 deletions src/components/Modals/Login/Login.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Modal, Button } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import './Login.css'
import Close from '../../../images/login/close.svg'
import Google from '../../../images/login/google.svg'
import Facebook from '../../../images/login/facebook.svg'

function Login({ onHide }) {
const { t } = useTranslation()
return (
<div>
<Modal show centered className="rounded">
<div className="bg-modal-login bg-modal-login-2">
<div className="d-flex justify-content-end">
<button
type="button"
className="bg-transparent border-0 m-1"
onClick={onHide}
>
<img
src={Close}
className="w-75 h-75"
alt="close modal"
/>
</button>
</div>
<div className="d-flex justify-content-center text-white mt-2">
<h4>{t('login.log-in')}</h4>
</div>
<div className="d-flex justify-content-center mt-5 mb-5">
<Button className="bg-white text-black w-50 rounded d-flex justify-content-center align-items-center py-2 border-0">
<img
src={Google}
alt="google icon"
width="19"
height="19"
className="d-block mt-1 mx-2 "
/>
<p className="text-dark my-auto small ">
{t('login.google')}
</p>
</Button>
</div>
<div className="d-flex justify-content-center mb-5 pb-5">
<Button className="background-facebook text-black w-50 rounded d-flex justify-content-center align-items-center py-2 border-0">
<img
src={Facebook}
alt="Facebook icon"
width="21"
height="21"
className="d-block mt-0 mx-2 "
/>
<p
className="text-white my-auto small
"
>
{t('login.facebook')}
</p>
</Button>
</div>
</div>
</Modal>
</div>
)
}

Login.propTypes = {
onHide: PropTypes.func.isRequired,
}

export default Login
22 changes: 15 additions & 7 deletions src/components/NavBar/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { Navbar, Nav, NavDropdown, Form } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import i18next from 'i18next'
import { BrowserRouter as Router, NavLink } from 'react-router-dom'
import Login from '../Modals/Login/Login'
import './NavBar.css'
import {
HOME_ROUTE,
ADOPT_ROUTE,
ABOUT_ROUTE,
RESOURCE_CAT_ROUTE,
RESOURCE_DOG_ROUTE,
LOGIN_ROUTE,
CONTACT_US_ROUTE,
} from '../../routes'
import 'bootstrap/dist/css/bootstrap.min.css'
Expand All @@ -22,6 +22,7 @@ export default function NavBar() {
dir: 'ltr',
className: 'ml-auto',
})
const [showLoginModal, setShowLoginModal] = useState(false)

const selectedLanguage = (lang) => {
i18next.changeLanguage(lang)
Expand Down Expand Up @@ -117,10 +118,10 @@ export default function NavBar() {
{t('navbar.contact')}
</Nav.Link>
<Nav.Link
as={NavLink}
activeClassName="selected"
exact
to={LOGIN_ROUTE}
onClick={() => {
setShowLoginModal(!showLoginModal)
}}
>
{t('navbar.logIn')}
</Nav.Link>
Expand All @@ -136,15 +137,22 @@ export default function NavBar() {
<option selected className="firstOption fa">
&#xf1ab;
</option>
<option value='en'>English</option>
<option value='ar'>عربي</option>
<option value='krd'>كردى</option>
<option value="en">English</option>
<option value="ar">عربي</option>
<option value="krd">كردى</option>
</Form.Control>
</Nav.Link>
</Nav>
</Navbar.Collapse>
</Navbar>
</Router>
{showLoginModal ? (
<Login
onHide={() => {
setShowLoginModal(!showLoginModal)
}}
/>
) : null}
</div>
)
}
Loading

0 comments on commit 669bb47

Please sign in to comment.