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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"react-dom": "^16.10.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.1.2",
"reactstrap": "^8.0.1"
"reactstrap": "^8.2.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
16 changes: 15 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@
}

.Nav-link {
display: flex;
justify-content: space-evenly;
align-items: center;
padding: 2rem;
text-decoration: none;

}

h1 {
text-align: center;
}

.Nav-link:hover {
text-decoration: none;
color: lightgrey;
}

.nav-item {
margin-top: 1rem;
}
}
10 changes: 7 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React from 'react';
import './App.css';
import { Home, About, Contact, Navigation } from './components';
import React from "react";
import "./App.css";
import { Home, About, Contact, Navigation } from "./components";
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
9 changes: 6 additions & 3 deletions src/components/About.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';

const About = () => <h1>About</h1>;
import React from "react";

const About = () => (
<div>
<h1>About</h1>;
</div>
);
export default About;
8 changes: 6 additions & 2 deletions src/components/Contact.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import React from 'react';
import React from "react";

const Contact = () => <h1>Contact</h1>;
const Contact = () => (
<div>
<h1>Contact</h1>;
</div>
);

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

const Home = () => <h1>Home</h1>;
const Home = () => (
<div>
<h1>Home</h1>;
</div>
);

export default Home;
32 changes: 20 additions & 12 deletions src/components/Navigation.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import React from 'react';
import React from "react";
import { Nav, NavItem } from "reactstrap";
import { Link } from "react-router-dom";

const Navigation = () => {
return (
<div>
<div className="App">
<Nav className="App">
<h1>React Router Mini</h1>
<div>
<a href="">Home</a>
</div>
<div>
<a href="">About</a>
</div>
<div>
<a href="">Contact</a>
</div>
</div>
<NavItem>
<Link className="Nav-link" to="/">
Home
</Link>
</NavItem>
<NavItem>
<Link className="Nav-link" to="/about">
About
</Link>
</NavItem>
<NavItem>
<Link className="Nav-link" to="/contact">
Contact
</Link>
</NavItem>
</Nav>
</div>
);
};
Expand Down
18 changes: 12 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import 'bootstrap/dist/css/bootstrap.css';
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import "bootstrap/dist/css/bootstrap.css";
import { BrowserRouter as Router } from "react-router-dom";

ReactDOM.render(<App />, document.getElementById('root'));
ReactDOM.render(
<Router>
<App />
</Router>,
document.getElementById("root")
);
Loading