Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const components = require('./components/index')

const BrowserRouter = react_router_dom.BrowserRouter
const Route = react_router_dom.Route
const HomePage = components.HomePage
const AboutPage = components.AboutPage
const ContactPage = components.ContactPage

/**
* Import component styles
Expand All @@ -24,11 +27,9 @@ require('./App.scss')
function App() {
return (
<BrowserRouter>
<components.Navigation />

<Route exact path="/" component={components.Home} />
<Route path="/about" component={components.About} />
<Route path="/contact" component={components.Contact} />
<Route exact path="/" component={HomePage} />
<Route path="/about" component={AboutPage} />
<Route path="/contact" component={ContactPage} />
</BrowserRouter>
)
}
Expand Down
22 changes: 2 additions & 20 deletions src/App.scss
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
/* @import 'bootstrap/dist/css/bootstrap.css'; */

/**
* Global styles
*/

body {
margin: 0;
padding: 0;
font-family: sans-serif;
}

/**
* Component styles
* Import global styles
*/

.Nav-link {
padding: 2rem;
}

.nav-item {
margin-top: 1rem;
}
@import './styles/index.scss';
23 changes: 0 additions & 23 deletions src/components/About.js

This file was deleted.

36 changes: 36 additions & 0 deletions src/components/AboutPage/AboutPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict'

/**
* Dependencies
*/

const React = require('react')
const shared = require('../shared/index')

/**
* Define component
*/

function AboutPage() {
return (
<div className="jsx-AboutPage">
<shared.Navigation />

<section>
<div className="container">
<div className="row">
<div className="col-12">
<h1>About Page</h1>
</div>
</div>
</div>
</section>
</div>
)
}

/**
* Export component
*/

module.exports = AboutPage
23 changes: 0 additions & 23 deletions src/components/Contact.js

This file was deleted.

36 changes: 36 additions & 0 deletions src/components/ContactPage/ContactPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict'

/**
* Dependencies
*/

const React = require('react')
const shared = require('../shared/index')

/**
* Define component
*/

function ContactPage() {
return (
<div className="jsx-ContactPage">
<shared.Navigation />

<section>
<div className="container">
<div className="row">
<div className="col-12">
<h1>Contact Page</h1>
</div>
</div>
</div>
</section>
</div>
)
}

/**
* Export component
*/

module.exports = ContactPage
23 changes: 0 additions & 23 deletions src/components/Home.js

This file was deleted.

36 changes: 36 additions & 0 deletions src/components/HomePage/HomePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict'

/**
* Dependencies
*/

const React = require('react')
const shared = require('../shared/index')

/**
* Define component
*/

function HomePage() {
return (
<div className="jsx-HomePage">
<shared.Navigation />

<section>
<div className="container">
<div className="row">
<div className="col-12">
<h1>Home Page</h1>
</div>
</div>
</div>
</section>
</div>
)
}

/**
* Export component
*/

module.exports = HomePage
44 changes: 0 additions & 44 deletions src/components/Navigation.js

This file was deleted.

7 changes: 3 additions & 4 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
*/

module.exports = {
Home: require('./Home'),
About: require('./About'),
Contact: require('./Contact'),
Navigation: require('./Navigation'),
HomePage: require('./HomePage/HomePage'),
AboutPage: require('./AboutPage/AboutPage'),
ContactPage: require('./ContactPage/ContactPage'),
}
49 changes: 49 additions & 0 deletions src/components/shared/Navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict'

/**
* Dependencies
*/

const React = require('react')
const react_router_dom = require('react-router-dom')
const styles = require('./styles/index')

/**
* Constants
*/

const Link = react_router_dom.Link

/**
* Define component
*/

function Navigation() {
return (
<header>
<styles.NavigationStyle>
<div className="container">
<div className="row py-4">
<div className="col-12 col-md-4 d-flex align-items-center">
<h3>React Router Mini</h3>
</div>

<div className="col-12 col-md-3"></div>

<div className="col-12 col-md-5 d-flex justify-content-between align-items-center">
<Link to="/">Home</Link>
<Link to="/about">About</Link>
<Link to="/contact">Contct</Link>
</div>
</div>
</div>
</styles.NavigationStyle>
</header>
)
}

/**
* Export component
*/

module.exports = Navigation
9 changes: 9 additions & 0 deletions src/components/shared/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict'

/**
* Export shared components
*/

module.exports = {
Navigation: require('./Navigation'),
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ const styled = styled_components.default
*/

let NavigationStyle = styled.div(() => `
text-align: center;
background-color: #333;
color: #FFF;

a {
color: #FFF;
padding: 15px 25px;
}
a:hover {
color: #DDD;
}
a:active {
color: #999;
}
`)

/**
Expand Down
File renamed without changes.
Loading