HomePage, AboutPage, Header and Navigation

master
Tudor Stanciu 2020-04-11 01:56:55 +03:00
parent 2d294ddccd
commit 8fce4efb4f
6 changed files with 82 additions and 5 deletions

17
src/components/App.js Normal file
View File

@ -0,0 +1,17 @@
import React from "react";
import { Route } from "react-router-dom";
import HomePage from "./home/HomePage";
import AboutPage from "./about/AboutPage";
import Header from "./common/Header";
function App() {
return (
<div className="container-fluid">
<Header />
<Route exact path="/" component={HomePage} />
<Route path="/about" component={AboutPage} />
</div>
);
}
export default App;

View File

@ -0,0 +1,13 @@
import React from "react";
const AboutPage = () => (
<div>
<h2>About</h2>
<p>
This app uses React, Redux, React Router, and many other helpful
libraries.
</p>
</div>
);
export default AboutPage;

View File

@ -0,0 +1,20 @@
import React from "react";
import { NavLink } from "react-router-dom";
const Header = () => {
const activeStyle = { color: "#F15B2A" };
return (
<nav>
<NavLink to="/" activeStyle={activeStyle} exact>
Home
</NavLink>
{" | "}
<NavLink to="/about" activeStyle={activeStyle}>
About
</NavLink>
</nav>
);
};
export default Header;

View File

@ -0,0 +1,14 @@
import React from "react";
import { Link } from "react-router-dom";
const HomePage = () => (
<div className="jumbotron">
<h1>Pluralsight Administration</h1>
<p>React, Redux and React Router for ultra-responsive web apps.</p>
<Link to="about" className="btn btn-primary btn-lg">
Learn more
</Link>
</div>
);
export default HomePage;

8
src/index.css Normal file
View File

@ -0,0 +1,8 @@
#app {
max-width: 850px;
margin: 0 auto;
}
nav {
padding: 20px 0 20px 0;
}

View File

@ -1,8 +1,13 @@
import React from "react";
import { render } from "react-dom";
import { BrowserRouter as Router } from "react-router-dom";
import "bootstrap/dist/css/bootstrap.min.css";
import App from "./components/App";
import "./index.css";
function Hi() {
return <p>Hi.</p>;
}
render(<Hi />, document.getElementById("app"));
render(
<Router>
<App />
</Router>,
document.getElementById("app")
);