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 @@ -23,7 +23,7 @@
"start": "nf start",
"lint": "eslint src",
"react-app": "react-scripts start",
"api": "json-server --id _id --watch --port 4000 db.json",
"api": "json-server --id _id --watch --port 3000 db.json",
"build": "react-scripts build",
"test": "npm run lint && react-scripts test --env=jsdom",
"eject": "react-scripts eject"
Expand Down
27 changes: 24 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
import React from "react";
import TopNav from "./components/TopNav";
import SideNav from "./components/SideNav";
import { BrowserRouter, Switch, Route } from "react-router-dom"
import Charts from "./components/Charts";
import Tables from "./components/Tables";
import Settings from "./components/Settings";
import Wall from "./components/Wall";
import Profiles from "./components/Profiles";
import Marquee from "./components/Marquee";
import Profile from "./components/Profile";
import Dashboard from "./components/Dashboard";

function App() {
return (
<div>
<BrowserRouter>
<div>
<div id="wrapper">
<nav className="navbar navbar-inverse navbar-fixed-top" role="navigation">
<TopNav />
<SideNav />
</nav>
<div style={{backgroundColor: "white"}}>
{/* PUT YOUR ROUTES HERE */}
<div>
<Switch>
<Route path="/charts" component={Charts} />
<Route path="/tables" component={Tables} />
<Route path="/settings" component={Settings} />
<Route path="/profiles" component={Profiles} />
<Route path="/wall" component={Wall} />
<Route path="/marquee/:text" component={Marquee} />
<Route path="/profile/:id" component={Profile} />
<Route path="/" component={Dashboard} />
</Switch>
</div>
</div>
</div>
</div>

</BrowserRouter>
);
}

Expand Down
11 changes: 11 additions & 0 deletions src/components/Charts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

function Charts(props) {
return (
<div>
Check out my chart
</div>
);
}

export default Charts;
4 changes: 2 additions & 2 deletions src/components/Marquee.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";

function Marquee(props) {
const message = "hello";
return (
const message = props.match.params.text;
return (
<marquee>{message}</marquee>
);
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from "react";
import {connect} from "react-redux";

function Profile(props) {
const userId = 0;
const userId = props.match.params.id;
const user = props.users.find(u => u.id == userId) || {};
return (
return (
<div>
<h3>{user.firstName} {user.lastName}</h3>
<h4>{user.occupation}</h4>
Expand All @@ -18,4 +18,3 @@ function Profile(props) {
export default connect(function (state) {
return {users: state.users};
})(Profile);

7 changes: 3 additions & 4 deletions src/components/Profiles.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import React from "react";
import {connect} from "react-redux";
import {Link} from "react-router-dom"

function Profiles(props) {
const userDivs = props.users.map((user,i) => {
return (
<div key={i}>
{user.firstName} - {user.lastName}
<a href="#"> View </a>
<Link to={"/profile/"+ user.id}> View </Link>
</div>);
});
return (
return (
<div>{userDivs}</div>
);
}

export default connect(function (state) {
return {users: state.users};
})(Profiles);


11 changes: 11 additions & 0 deletions src/components/Settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

function Settings(props) {
return (
<div>
Check out my settings!
</div>
);
}

export default Settings;
49 changes: 39 additions & 10 deletions src/components/SideNav.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,58 @@
import React from "react";
// import {Link} from "react-router-dom";
import {Link} from "react-router-dom";

function SideNav() {
return (
<div className="collapse navbar-collapse navbar-ex1-collapse">
<ul className="nav navbar-nav side-nav">
<li className="active">
{/*
<Link to="/"> <i className="fa fa-fw fa-dashboard" />
Dashboard
{
<Link to={"/"}>
<i className="fa fa-fw fa-dashboard" /> Dashboard
</Link>
*/}
}
</li>
<li>
<a href="charts.html">
<Link to={"/charts"}>
<i className="fa fa-fw fa-bar-chart-o" /> Charts
</a>
</Link>
</li>
<li>
<a href="tables.html">
<Link to={"/tables"}>
<i className="fa fa-fw fa-table" /> Tables
</a>
</Link>
</li>
<li>
<Link to={"/settings"}>
<i className="fa fa-fw fa-gear" /> Settings
</Link>
</li>
<li>
<Link to={"/wall"}>
<i className="fa fa-fw fa-home" /> Wall
</Link>
</li>
<li>
<Link to={"/profiles"}>
<i className="fa fa-fw fa-user" /> Profiles
</Link>
</li>
<li>
<Link to={"/marquee/iloveroutes"}>
<i className="fa fa-fw fa-heart" /> Marquee "I love routes"
</Link>
</li>
<li>
<Link to={"/marquee/reactrouterrules"}>
<i className="fa fa-fw fa-heart" /> Marquee "React Router Rules"
</Link>
</li>
</ul>
</div>);
</div>);
}

export default SideNav;

// <a href="charts.html">
// <i className="fa fa-fw fa-bar-chart-o" /> Charts
// </a>
11 changes: 11 additions & 0 deletions src/components/Tables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

function Tables(props) {
return (
<div>
Check out my table!
</div>
);
}

export default Tables;
11 changes: 11 additions & 0 deletions src/components/Wall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

function Wall(props) {
return (
<div>
Check out my wall!
</div>
);
}

export default Wall;