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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
### Setup
### Setup - Ericka Barnes-Emery
* Fork, Clone, yarn install, yarn start
* Do Not use the instructions as your guide for what code to type, use the reference guide project (address book)
* Slight quirk - refreshing doesn't work from any path other than the default one so you will have to go back to the default path to refresh

### App.js
### App.js - DONE
* Import BrowserRouter,Switch and Route from react-router-dom
* Import components needed
* Create the appropriate routes `{/* PUT YOUR ROUTES HERE */}`
* Make sure the default route goes at the bottom
* Make sure BrowserRouter wraps everything
* Make sure you use the component prop, not render.

### Routes
### Routes - DONE
* / -> Dashboard
* /charts -> Charts
* /tables -> Tables
Expand All @@ -21,13 +21,13 @@
* /marquee/:text -> Marquee
* /profile/:id -> Profile

### Create these components. The content of the components is not important, just put anything `<div> whatever </div>`
### Create these components. The content of the components is not important, just put anything `<div> whatever </div>` - DONE
* Charts.js
* Tables.js
* Settings.js
* Wall.js

### Existing components
### Existing components - DONE
* Profiles.js
* Import Link from react-router-dom
* change the `<a>` to be a Link that links to `/profile/ + user.id`
Expand All @@ -37,7 +37,7 @@
* Marquee
* replace the hard coded "hello" with the text parameter from the route

### SideNav
### SideNav - DONE
* Import Link from react-router-dom
* Create links to all the routes except Profile
* Hard code some links to Marquee
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react": "^15.3.2",
"react-dom": "^15.3.2",
"react-redux": "^5.0.4",
"react-router-dom": "^4.1.1",
"react-router-dom": "^4.2.2",
"redux": "^3.6.0"
},
"scripts": {
Expand Down
23 changes: 22 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
import React from "react";
import TopNav from "./components/TopNav";
import SideNav from "./components/SideNav";
import Charts from "./components/Charts";
import Tables from "./components/Tables";
import Settings from "./components/Settings";
import Wall from "./components/Wall";
import Marquee from "./components/Marquee";
import Profiles from "./components/Profiles";
import Profile from "./components/Profile";
import Dashboard from "./components/Dashboard";
import {Link} from "react-router-dom";
import {BrowserRouter,Route,Switch} from "react-router-dom";

function App() {
return (
<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 */}
<Switch>
<Route path="/charts" component={Charts} />
<Route path="/tables" component={Tables} />
<Route path="/settings" component={Settings} />
<Route path="/wall" component={Wall} />
<Route path="/profiles" component={Profiles} />
<Route path="/marquee/:text" component={Marquee} />
<Route path="/profile/:id" component={Profile} />
<Route path="/" component={Dashboard} />
</Switch>
</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() {
return (
<div>
<h1>This is Charts</h1>
</div>
);
}

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

function Marquee(props) {
const message = "hello";
const message = props.match.params.text;
return (
<marquee>{message}</marquee>
);
Expand Down
4 changes: 2 additions & 2 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 Down
3 changes: 2 additions & 1 deletion src/components/Profiles.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
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 (
Expand Down
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() {
return (
<div>
<h1>This is Settings</h1>
</div>
);
}

export default Settings;
37 changes: 30 additions & 7 deletions src/components/SideNav.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
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>
*/}
</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-bar-chart-o" /> Settings
</Link>
</li>
<li>
<Link to="/Wall">
<i className="fa fa-fw fa-bar-chart-o" /> Wall
</Link>
</li>
<li>
<Link to="/Profiles">
<i className="fa fa-fw fa-bar-chart-o" /> Profiles
</Link>
</li>
<li>
<Link to="/Marquee/iloveroutes">
<i className="fa fa-fw fa-bar-chart-o" /> Marquee
</Link>
</li>
<li>
<Link to="/Marquee/reactrouterrules">
<i className="fa fa-fw fa-bar-chart-o" /> Marquee Lerv
</Link>
</li>
</ul>
</div>);
Expand Down
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() {
return (
<div>
<h1>This is Tables</h1>
</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 Walls() {
return (
<div>
<h1>This is Walls</h1>
</div>
);
}

export default Walls;
54 changes: 30 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2606,24 +2606,28 @@ [email protected]:
version "1.1.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.0.tgz#29319d49beec13a9b1f3c4f9b2a6dde4859bb2a7"

history@^4.5.1, history@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/history/-/history-4.6.1.tgz#911cf8eb65728555a94f2b12780a0c531a14d2fd"
history@^4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/history/-/history-4.7.2.tgz#22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b"
dependencies:
invariant "^2.2.1"
loose-envify "^1.2.0"
resolve-pathname "^2.0.0"
value-equal "^0.2.0"
resolve-pathname "^2.2.0"
value-equal "^0.4.0"
warning "^3.0.0"

[email protected]:
version "2.16.3"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"

hoist-non-react-statics@^1.0.3, hoist-non-react-statics@^1.2.0:
hoist-non-react-statics@^1.0.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb"

hoist-non-react-statics@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0"

home-or-tmp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
Expand Down Expand Up @@ -4194,7 +4198,7 @@ [email protected]:
version "0.1.7"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"

path-to-regexp@^1.5.3:
path-to-regexp@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d"
dependencies:
Expand Down Expand Up @@ -4678,24 +4682,26 @@ react-redux@^5.0.4:
loose-envify "^1.1.0"
prop-types "^15.0.0"

react-router-dom@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.1.1.tgz#3021ade1f2c160af97cf94e25594c5f294583025"
react-router-dom@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.2.2.tgz#c8a81df3adc58bba8a76782e946cbd4eae649b8d"
dependencies:
history "^4.5.1"
history "^4.7.2"
invariant "^2.2.2"
loose-envify "^1.3.1"
prop-types "^15.5.4"
react-router "^4.1.1"
react-router "^4.2.0"
warning "^3.0.0"

react-router@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.1.1.tgz#d448f3b7c1b429a6fbb03395099949c606b1fe95"
react-router@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.2.0.tgz#61f7b3e3770daeb24062dae3eedef1b054155986"
dependencies:
history "^4.6.0"
hoist-non-react-statics "^1.2.0"
history "^4.7.2"
hoist-non-react-statics "^2.3.0"
invariant "^2.2.2"
loose-envify "^1.3.1"
path-to-regexp "^1.5.3"
path-to-regexp "^1.7.0"
prop-types "^15.5.4"
warning "^3.0.0"

Expand Down Expand Up @@ -5021,9 +5027,9 @@ resolve-from@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"

resolve-pathname@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.1.0.tgz#e8358801b86b83b17560d4e3c382d7aef2100944"
resolve-pathname@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.2.0.tgz#7e9ae21ed815fd63ab189adeee64dc831eefa879"

[email protected], [email protected]:
version "1.1.7"
Expand Down Expand Up @@ -5685,9 +5691,9 @@ validate-npm-package-license@^3.0.1:
spdx-correct "~1.0.0"
spdx-expression-parse "~1.0.0"

value-equal@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.1.tgz#c220a304361fce6994dbbedaa3c7e1a1b895871d"
value-equal@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.4.0.tgz#c5bdd2f54ee093c04839d71ce2e4758a6890abc7"

vary@^1, vary@~1.1.0:
version "1.1.0"
Expand Down