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
16 changes: 16 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
html,
body,
#root{
background-color: blue;
color: white;
font-weight: bold;
}

.App {
padding-top: 5%;
text-align: center;
}

Expand All @@ -9,3 +18,10 @@
.nav-item {
margin-top: 1rem;
}

.content{
padding-top: 5%;
text-align: center;
}


5 changes: 5 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react';
import './App.css';
import { Home, About, Contact, Navigation } from './components';
// Inside of your App.js file import { Route } from 'react-router-dom';
import { Route } from 'react-router-dom';

const App = () => (
<div>
<Navigation />
<Route exact path='/' component={Home}/>
<Route exact path='/about' component={About}/>
<Route exact path='/contact' component={Contact}/>
</div>
);

Expand Down
7 changes: 6 additions & 1 deletion src/components/About.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import React from 'react';

const About = () => <h1>About</h1>;
const About = () =>
<div className="content">
<img src="https://media.giphy.com/media/26FeU2tmGFSedYNxe/giphy.gif"/>
</div>

;

export default About;
4 changes: 3 additions & 1 deletion src/components/Contact.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';

const Contact = () => <h1>Contact</h1>;
const Contact = () => <div className="content">
<img src="https://media.giphy.com/media/3o6Mb5h1UQlrtoebK0/giphy.gif"/>
</div>;

export default Contact;
8 changes: 7 additions & 1 deletion src/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from 'react';

const Home = () => <h1>Home</h1>;
const Home = () =>
<div className="content">

<img src="https://media.giphy.com/media/hWXisyrFbbCm293C5F/giphy.gif"/>
</div>

;

export default Home;
9 changes: 6 additions & 3 deletions src/components/Navigation.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import React from 'react';
// Inside of Navigation.js import { Link } from 'react-router-dom'.
import { Link } from 'react-router-dom';

const Navigation = () => {
return (
<div>
<div className="App">
<h1>React Router Mini</h1>
{/* Declare the to as the href on <Link> and specify the correct routes for your app to navigate towards. */}
<div>
<a href="">Home</a>
<Link to="/">Home</Link>
</div>
<div>
<a href="">About</a>
<Link to="/about">About</Link>
</div>
<div>
<a href="">Contact</a>
<Link to="/contact">Contact</Link>
</div>
</div>
</div>
Expand Down
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@ import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import 'bootstrap/dist/css/bootstrap.css';
// import your BrowserRouter as Router inside your index.js file.
import { BrowserRouter as Router} from 'react-router-dom';

ReactDOM.render(<App />, document.getElementById('root'));
// Wrap your <App /> component that you're passing to ReactDOM.render() with your new Router component.
ReactDOM.render(
<Router>
<App />
</Router>
,document.getElementById('root'));