-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
460 additions
and
17 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
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,41 @@ | ||
import React from 'react'; | ||
import { BrowserRouter as Router, Switch } from "react-router-dom"; | ||
import React from 'react' | ||
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom' | ||
import NavBar from './components/NavBar/NavBar' | ||
import { | ||
HOME_ROUTE, | ||
ADOPT_ROUTE, | ||
ABOUT_ROUTE, | ||
RESOURCE_CAT_ROUTE, | ||
RESOURCE_DOG_ROUTE, | ||
LOGIN_ROUTE, | ||
SIGNUP_ROUTE, | ||
CONTACT_US_ROUTE, | ||
} from './routes' | ||
|
||
function App() { | ||
|
||
return ( | ||
<Router> | ||
<Switch> | ||
<p>Hello wordl!</p> | ||
</Switch> | ||
</Router> | ||
); | ||
return ( | ||
<Router> | ||
<NavBar /> | ||
<Switch> | ||
<Route path={ADOPT_ROUTE}>{/** <ADOPT_ROUTE/> */}</Route> | ||
<Route path={ABOUT_ROUTE}>{/** <ABOUT_ROUTE/> */}</Route> | ||
<Route path={LOGIN_ROUTE}>{/** <LOGIN_ROUTE/> */}</Route> | ||
<Route path={SIGNUP_ROUTE}>{/** <SIGNUP_ROUTE/> */}</Route> | ||
<Route path={RESOURCE_CAT_ROUTE}> | ||
{/** <RESOURCE_CAT_ROUTE/> */} | ||
</Route> | ||
<Route path={RESOURCE_DOG_ROUTE}> | ||
{/** <RESOURCE_DOG_ROUTE/> */} | ||
</Route> | ||
<Route path={CONTACT_US_ROUTE}> | ||
{/** <CONTACT_US_ROUTE/> */} | ||
</Route> | ||
<Route path={HOME_ROUTE} exact> | ||
{/** <HOME_ROUTE/> */} | ||
</Route> | ||
</Switch> | ||
</Router> | ||
) | ||
} | ||
|
||
export default App; | ||
export default 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
.navBar { | ||
background: linear-gradient(45deg, #fe6b8b, #ff8e53 100%); | ||
padding: 0 !important; | ||
} | ||
|
||
.navBar a { | ||
text-decoration: none; | ||
color: rgb(255, 246, 246) !important; | ||
margin-right: 25px; | ||
margin-left: 25px; | ||
font-weight: 400; | ||
} | ||
|
||
a.dropdown-item { | ||
margin: auto; | ||
} | ||
|
||
.selected { | ||
border-bottom: 2px solid white; | ||
margin-bottom: 3px; | ||
} | ||
|
||
.nav-link { | ||
transition: color 0.5s; | ||
} | ||
.nav-link:hover { | ||
color: #696964 !important; | ||
} | ||
|
||
a.dropdown-item { | ||
color: #ff8e53 !important; | ||
margin: auto; | ||
} | ||
|
||
.dropdown-item:active { | ||
background: white; | ||
} | ||
.logo { | ||
margin-left: 10px; | ||
} | ||
.logo img { | ||
width: 55px; | ||
height: 55px; | ||
} | ||
.navbar-light .navbar-toggler-icon { | ||
background-image: url('../../images/burger.png'); | ||
} | ||
|
||
.navbar-toggler-icon { | ||
display: inline-block; | ||
width: 1.3em; | ||
height: 1em; | ||
} | ||
.navbar-light .navbar-toggler { | ||
border-color: rgba(0, 0, 0, 0); | ||
} | ||
|
||
.selectLang { | ||
background: none; | ||
color: rgb(255, 246, 246) !important; | ||
font-weight: 400; | ||
border: none; | ||
margin-right: 0px; | ||
padding: 10; | ||
outline-style: none; | ||
box-shadow: none; | ||
border-color: transparent; | ||
} | ||
|
||
.selectLang:focus { | ||
outline: none; | ||
box-shadow: none; | ||
} | ||
.selectLang option { | ||
color: #ff8e53 !important; | ||
font-weight: 300; | ||
font-size: 18px !important; | ||
text-align: center; | ||
} | ||
|
||
.firstOption{ | ||
display: none; | ||
} | ||
|
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,150 @@ | ||
import React, { useState, useEffect } from 'react' | ||
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 './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' | ||
import logo from '../../images/logo.ico' | ||
|
||
export default function NavBar() { | ||
const { t } = useTranslation() | ||
const [dirProperties, setDir] = useState({ | ||
dir: 'ltr', | ||
className: 'ml-auto', | ||
}) | ||
|
||
const selectedLanguage = (lang) => { | ||
i18next.changeLanguage(lang) | ||
} | ||
const handelOption = (e) => { | ||
selectedLanguage(e.target.value) | ||
} | ||
|
||
const handelDir = () => { | ||
if (localStorage.getItem('i18nextLng') !== 'en') { | ||
const newDir = 'rtl' | ||
const newClassName = 'mr-auto' | ||
const newdirProperties = { ...dirProperties } | ||
newdirProperties.dir = newDir | ||
newdirProperties.className = newClassName | ||
setDir(newdirProperties) | ||
} else { | ||
const newDir = 'ltr' | ||
const newClassName = 'ml-auto' | ||
const newdirProperties = { ...dirProperties } | ||
newdirProperties.dir = newDir | ||
newdirProperties.className = newClassName | ||
setDir(newdirProperties) | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
handelDir() | ||
}, [localStorage.getItem('i18nextLng')]) | ||
|
||
return ( | ||
<div dir={dirProperties.dir} data-testid="NavBar"> | ||
<Router> | ||
<Navbar className="navBar" expand="lg"> | ||
<Navbar.Brand className="logo" as={NavLink} to={HOME_ROUTE}> | ||
<img src={logo} alt="" /> | ||
</Navbar.Brand> | ||
<Navbar.Toggle /> | ||
<Navbar.Collapse id="basic-navbar-nav"> | ||
<Nav className={dirProperties.className}> | ||
<Nav.Link | ||
as={NavLink} | ||
to={HOME_ROUTE} | ||
activeClassName="selected" | ||
exact | ||
> | ||
{t('navbar.home')} | ||
</Nav.Link> | ||
<Nav.Link | ||
as={NavLink} | ||
to={ABOUT_ROUTE} | ||
activeClassName="selected" | ||
exact | ||
> | ||
{t('navbar.about')} | ||
</Nav.Link> | ||
<Nav.Link | ||
as={NavLink} | ||
to={ADOPT_ROUTE} | ||
RESOURCE_CAT_ROUTE | ||
activeClassName="selected" | ||
exact | ||
> | ||
{t('navbar.adopt')} | ||
</Nav.Link> | ||
<NavDropdown | ||
className="drop" | ||
title={t('navbar.resources.0')} | ||
> | ||
<NavDropdown.Item | ||
as={NavLink} | ||
activeClassName="selected" | ||
exact | ||
to={RESOURCE_CAT_ROUTE} | ||
> | ||
{t('navbar.resources.1')} | ||
</NavDropdown.Item> | ||
<NavDropdown.Item | ||
as={NavLink} | ||
activeClassName="selected" | ||
exact | ||
to={RESOURCE_DOG_ROUTE} | ||
> | ||
{t('navbar.resources.2')} | ||
</NavDropdown.Item> | ||
</NavDropdown> | ||
<Nav.Link | ||
as={NavLink} | ||
activeClassName="selected" | ||
exact | ||
to={CONTACT_US_ROUTE} | ||
> | ||
{t('navbar.contact')} | ||
</Nav.Link> | ||
<Nav.Link | ||
as={NavLink} | ||
activeClassName="selected" | ||
exact | ||
to={LOGIN_ROUTE} | ||
> | ||
{t('navbar.logIn')} | ||
</Nav.Link> | ||
<Nav.Link className="fa"> | ||
<Form.Control | ||
className="selectLang" | ||
onChange={handelOption} | ||
as="select" | ||
size="sm" | ||
custom | ||
value="" | ||
> | ||
<option selected className="firstOption fa"> | ||
 | ||
</option> | ||
<option value='en'>English</option> | ||
<option value='ar'>عربي</option> | ||
<option value='krd'>كردى</option> | ||
</Form.Control> | ||
</Nav.Link> | ||
</Nav> | ||
</Navbar.Collapse> | ||
</Navbar> | ||
</Router> | ||
</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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.