diff --git a/src/App.jsx b/src/App.jsx index 902a9c1..9186e2b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,5 +1,6 @@ import React from "react"; import Table from "./Table"; +import List from "./List"; class App extends React.Component { constructor(props) { @@ -7,24 +8,35 @@ class App extends React.Component { this.state = { buttonClicked: "", - assignments: [], - grades: {} + assignments: [] /*Below this line, add the students state variable*/, + students: [], + grades: {}, }; this.handleButtonClicked = this.handleButtonClicked.bind(this); this.addAssignment = this.addAssignment.bind(this); + /*Uncomment the line below to bind the method*/ + this.addStudent = this.addStudent.bind(this); this.addGrade = this.addGrade.bind(this); } handleButtonClicked(buttonName) { this.setState({ - buttonClicked: buttonName + buttonClicked: buttonName, }); } + /*Check out this addAssignment method*/ addAssignment(assignmentName) { this.setState({ - assignments: this.state.assignments.concat(assignmentName) + assignments: this.state.assignments.concat(assignmentName), + }); + } + + /*Write an addStudent method here*/ + addStudent(studentName) { + this.setState({ + assignments: this.state.students.concat(studentName), }); } @@ -42,10 +54,48 @@ class App extends React.Component { render() { let tabChoice =
; + /*Uncomment below to render assignments*/ + if (this.state.buttonClicked === "assignments") { + tabChoice = ( + + ); + } + + /* Change below to render students*/ + + if (this.state.buttonClicked === "students") { + tabChoice = ( + + ); + } + + /* Uncomment lines below to render grades*/ + if (this.state.buttonClicked === "grades") { + tabChoice = ( + + ); + } + return (
+

GradeBook