diff --git a/src/components/Application.js b/src/components/Application.js index 2e192ae..c6bec7d 100644 --- a/src/components/Application.js +++ b/src/components/Application.js @@ -2,6 +2,7 @@ import React, { useState } from "react"; import "components/Application.scss"; import DayList from "./DayList"; +import Appointment from "./Appointment/index"; const days = [ { @@ -21,6 +22,57 @@ const days = [ }, ]; +const appointments = [ + { + id: 1, + time: "12pm", + }, + { + id: 2, + time: "1pm", + interview: { + student: "Lydia Miller-Jones", + interviewer: { + id: 1, + name: "Sylvia Palmer", + avatar: "https://i.imgur.com/LpaY82x.png", + } + } + }, + { + id: 3, + time: "2pm", + interview: { + student: "Mild-Mannered Pate", + interviewer: { + id: 1, + name: "Sylvia Palmer", + avatar: "https://i.imgur.com/LpaY82x.png", + } + } + }, + { + id: 4, + time: "3pm", + }, + { + id: 5, + time: "4pm", + interview: { + student: "Creighton The Wanderer", + interviewer: { + id: 1, + name: "Sylvia Palmer", + avatar: "https://i.imgur.com/LpaY82x.png", + } + } + }, + { + id: 6, + time: "5pm", + }, +]; + export default function Application(props) { const [day, setDay] = useState(""); @@ -47,7 +99,13 @@ export default function Application(props) { />
- {/* Replace this with the schedule elements durint the "The Scheduler" activity. */} + {appointments.map((appointment) => + + )}
); diff --git a/src/components/Appointment/Form.js b/src/components/Appointment/Form.js new file mode 100644 index 0000000..94cc5d5 --- /dev/null +++ b/src/components/Appointment/Form.js @@ -0,0 +1,53 @@ +import React, { useState } from "react"; +import Button from "components/Button"; +import InterviewerList from "components/InterviewerList"; + + + +export default function Form(props) { + + const [name, setName] = useState(props.name || ""); + const valueChange = (event) => { + return setName(event.target.value); + } + + const [interviewer, setInterviewer] = useState(props.interviewer || null); + + const reset = (event) => { + setName(""); + setInterviewer(null); + } + const cancel = (event) => { + reset(); + props.onCancel() + } + + return ( +
+
+
event.preventDefault()}> + +
+ +
+
+
+ + +
+
+
+ ) +} \ No newline at end of file diff --git a/src/components/Appointment/index.js b/src/components/Appointment/index.js index eb68d04..e47db16 100644 --- a/src/components/Appointment/index.js +++ b/src/components/Appointment/index.js @@ -1,10 +1,19 @@ import React from "react"; - import "components/Appointment/styles.scss"; +import Header from "components/Appointment/Header"; +import Show from "components/Appointment/Show"; +import Empty from "components/Appointment/Empty"; export default function Appointment(props) { return ( -
+
+
+ {props.interview ? + : } +
) } \ No newline at end of file diff --git a/src/components/InterviewerList.js b/src/components/InterviewerList.js index 731e7d6..f4e932a 100644 --- a/src/components/InterviewerList.js +++ b/src/components/InterviewerList.js @@ -19,7 +19,7 @@ export default function InterviewerList(props) { key={interviewer.id} {...interviewer} selected={interviewer.id === props.interviewer} - setInterviewer={(event) => {props.setInterviewer(interviewer.id)}} + setInterviewer={event => props.setInterviewer(interviewer.id)} /> ) }) diff --git a/src/components/InterviewerListItem.js b/src/components/InterviewerListItem.js index 0aa9b32..eda2ab0 100644 --- a/src/components/InterviewerListItem.js +++ b/src/components/InterviewerListItem.js @@ -6,9 +6,7 @@ import classNames from "classnames"; export default function InterviewerListItem(props) { let interviewerClass = classNames( 'interviewers__item', - { - 'interviewers__item--selected': props.selected - } + {'interviewers__item--selected': props.selected} ); diff --git a/stories/index.js b/stories/index.js index 782df18..155c60e 100644 --- a/stories/index.js +++ b/stories/index.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { Fragment } from "react"; import { storiesOf } from "@storybook/react"; import { action } from "@storybook/addon-actions"; @@ -18,6 +18,7 @@ import Show from "components/Appointment/Show"; import Confirm from "components/Appointment/Confirm"; import Status from "components/Appointment/Status"; import Error from "components/Appointment/Error"; +import Form from "components/Appointment/Form"; //--------Button Component-------- @@ -110,7 +111,7 @@ storiesOf("InterviewerListItem", module) id={interviewer.id} name={interviewer.name} avatar={interviewer.avatar} - setInterviewer={(event) => {action("setInterviewer")(interviewer.id)}} + setInterviewer={event => action("setInterviewer")(interviewer.id)} /> )); @@ -148,6 +149,22 @@ storiesOf("Appointment", module) }) .add("Appointment", () => ) .add("Appointment with Time", () => ) + .add("Appointment Empty", () => ( + + + + + )) + .add("Appointment Booked", () => ( + + + + + )) .add("Header", () =>
) .add("Empty", () => ) .add("Show", () => ( @@ -171,4 +188,20 @@ storiesOf("Appointment", module) message="Could not delete appointment." onClose={action("onClose")} /> + )) + .add("Form Edit", () => ( +
+ )) + .add("Form Create", () => ( + )) \ No newline at end of file