-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ft(create headers):create navbar and fouter
- created navbar component - created footer component
- Loading branch information
Gidraf
committed
Dec 4, 2018
1 parent
991512b
commit c039be0
Showing
10 changed files
with
112 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,20 @@ | ||
import React from 'react'; | ||
import './App.scss'; | ||
import 'bootstrap'; | ||
import 'bootstrap/dist/css/bootstrap.min.css'; | ||
|
||
|
||
export const Bar = () => ( | ||
<nav className="navbar navbar-expand-lg navbar-light bg-light"> | ||
<button className="navbar-brand" href="#">Authors Haven</button> | ||
<button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span className="navbar-toggler-icon" /> | ||
</button> | ||
</nav> | ||
|
||
); | ||
|
||
export const Foot = () => ( | ||
<div className="navbar-light footer"> | ||
<span>© 2018 Author Haven.</span> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.navbutton { | ||
border-radius: 10px; | ||
} | ||
|
||
$color-primary: #f5f5f5; | ||
$color-font: #424242; | ||
|
||
.footer { | ||
background-color: $color-primary; | ||
bottom: 0; | ||
color: $color-font; | ||
font-size: 1vw; | ||
left: 0; | ||
position: fixed; | ||
text-align: center; | ||
width: 100%; | ||
} |
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,9 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Bar } from '../App'; | ||
|
||
it('footer render without crashing', () => { | ||
const div = document.createElement('nav'); | ||
ReactDOM.render(<Bar />, div); | ||
ReactDOM.unmountComponentAtNode(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
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,32 +1,20 @@ | ||
import React from 'react'; | ||
import { HomePage, LoginPage } from '../views/HomePage'; | ||
import { BrowserRouter, Route, Link, Switch } from 'react-router-dom'; | ||
import { HomePage, LoginPage, Header, Footer } from '../views/HomePage'; | ||
import { BrowserRouter, Route, Switch } from 'react-router-dom'; | ||
|
||
const Main = () => ( | ||
export const Main = () => ( | ||
<Switch> | ||
<Route exact path="/" component={HomePage} /> | ||
<Route path="/login/" component={LoginPage} /> | ||
</Switch> | ||
); | ||
|
||
const Header = () => ( | ||
<ul> | ||
<li> | ||
<button ><Link to="/">Home</Link></button> | ||
</li> | ||
<li > | ||
<button><Link to="/login">Login</Link></button> | ||
</li> | ||
</ul> | ||
); | ||
|
||
const Routes = () => ( | ||
export const Routes = () => ( | ||
<BrowserRouter> | ||
<div> | ||
<Header /> | ||
<Main /> | ||
<Footer /> | ||
</div> | ||
</BrowserRouter> | ||
); | ||
|
||
export default Routes; |
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,30 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { MemoryRouter } from 'react-router'; | ||
import { HomePage, LoginPage } from '../views/HomePage'; | ||
import { Main } from './Routes'; | ||
|
||
test('test if home page link return homepage component', () => { | ||
const url = ['/', | ||
]; | ||
const wrapper = mount( | ||
<MemoryRouter initialEntries={url}> | ||
<Main /> | ||
</MemoryRouter> | ||
); | ||
expect(wrapper.find(HomePage)).toHaveLength(1); | ||
expect(wrapper.find(LoginPage)).toHaveLength(0); | ||
}); | ||
|
||
test('test if home page link return homepage component', () => { | ||
const Login = Main; | ||
const url = ['/login', | ||
]; | ||
const wrapper = mount( | ||
<MemoryRouter initialEntries={url}> | ||
<Login /> | ||
</MemoryRouter> | ||
); | ||
expect(wrapper.find(LoginPage)).toHaveLength(1); | ||
expect(wrapper.find(HomePage)).toHaveLength(0); | ||
}); |
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