diff --git a/package.json b/package.json index a449367b..f3640f61 100644 --- a/package.json +++ b/package.json @@ -3,17 +3,18 @@ "version": "0.1.0", "private": true, "devDependencies": { - "babel-eslint": "^7.1.1", - "eslint": "^3.14.0", + "babel-eslint": "^7.0.0", + "eslint": "^3.8.1", "eslint-plugin-babel": "^4.0.1", - "eslint-plugin-react": "^6.9.0", - "react-scripts": "0.7.0" + "eslint-plugin-react": "^6.4.1", + "react-scripts": "^0.7.0" }, "dependencies": { "foreman": "^2.0.0", "json-server": "^0.9.4", - "react": "^15.3.2", - "react-dom": "^15.3.2" + "react": "^15.6.1", + "react-dom": "^15.3.2", + "react-select": "^1.0.0-rc.5" }, "scripts": { "start": "nf start", @@ -24,5 +25,5 @@ "test": "npm run lint && react-scripts test --env=jsdom", "eject": "react-scripts eject" }, - "proxy" : "http://localhost:3001" + "proxy": "http://localhost:3001" } diff --git a/src/App.js b/src/App.js index 0042c777..26640417 100644 --- a/src/App.js +++ b/src/App.js @@ -1,8 +1,33 @@ import React from "react"; import logo from "./logo.svg"; import "./App.css"; +import ListOfUsers from './components/ListOfUsers'; +import UserDetail from './components/UserDetail'; +import Select from 'react-select'; +import SelectCont from './components/SelectCont'; +import courses from "./courses" -function App() { +<<<<<<< HEAD + +function App(props) { +======= +let days = [ + {value:"M", label:"MON-WENS"}, + {value:"T",label:"TUES-THURS"}, + {value:"W", label:"WENS-FRI"}, + {value:"S",label:"SAT"} + ]; +>>>>>>> 05556120e7ebd366568f7292041d48bdae49cbd6 + +function App(props) { + + // let names = props.users.map((x) => { + // return { + // value:x.first_name, + // label:x.first_name + // } + // }); + return (
@@ -12,6 +37,10 @@ function App() {

To get started, edit src/App.js and save to reload.

+ + console.log(props) + +
); } diff --git a/src/components/Button.js b/src/components/Button.js new file mode 100644 index 00000000..9bfab821 --- /dev/null +++ b/src/components/Button.js @@ -0,0 +1,27 @@ +import React from 'react'; +export default class Button extends React.Component { + + constructor(props) { + super(props); + this.state = {showing: true}; + + // This binding is necessary to make `this` work in the callback + this.handleClick = this.handleClick.bind(this); + } + + handleClick() { + this.setState(prevState => ({ + showing: !prevState.showing + })); + } + + render() { + // let buttonVal = + // this.state.showing ? 'Hide' : 'Show'; + return ( + + ); + } +} diff --git a/src/components/ListOfUsers.js b/src/components/ListOfUsers.js new file mode 100644 index 00000000..642ba91c --- /dev/null +++ b/src/components/ListOfUsers.js @@ -0,0 +1,65 @@ +import React from 'react'; +// import Button from './Button.js'; +// import users from '../users'; + +export default class ListOfUsers extends React.Component { + constructor(props){ + super(props); + this.state = { + visible: true, + searchText: '' + } + + this.onClick = this.onClick.bind(this); + this.handleChange = this.handleChange.bind(this); + this.userClick = this.userClick.bind(this); + } + onClick() { + if(document.getElementById('list').style.display === (""||'none')){ + document.getElementById('list').style.display = 'block'; + }else{ + document.getElementById('list').style.display = 'none'; + } + this.setState({ + visible: this.state.visible ? false : true + }) + + } + + handleChange(e) { + this.setState({ + searchText: e.target.value + }) + } + + userClick(e) { + console.log(e.target); + let user = this.props.users.filter(function(x){ + return x.first_name === e.target.innerHTML; + }) + console.log(user[0]); + this.props.getUser(user); + } + render(){ + + + let show = this.state.visible ? 'Hide' : 'Show'; + var filterUsers = this.props.users.filter((u)=>{ + // if(this.state.searchText == ""){ + // return true; + // } + return u.first_name.indexOf(this.state.searchText) > -1 ? true : (this.state.searchText == "" ? true : false); + }) + let userAr = filterUsers.map((x,i) =>
{this.userClick(e)}}>{x.first_name}
); + return( +
+ {this.handleChange(e)}}> +
+ +
{userAr}
+
+ ); + + + } +} \ No newline at end of file diff --git a/src/components/SelectCont.js b/src/components/SelectCont.js new file mode 100644 index 00000000..6f5856d5 --- /dev/null +++ b/src/components/SelectCont.js @@ -0,0 +1,27 @@ +import React from "react"; +import {Component} from "react"; +import Select from 'react-select'; +import courses from "../courses"; + +let days = [ + {value:"M", label:"MON-WENS"}, + {value:"T",label:"TUES-THURS"}, + {value:"W", label:"WENS-FRI"}, + {value:"S",label:"SAT"} + ]; + + +export default function SelectCont(props){ + + return(
+ MonWed +