From a099d50097a57ba29406c4998a55aa0c2c24ef35 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Sun, 26 Jul 2020 00:41:33 +0200 Subject: [PATCH] further hacking --- components/contact.js | 29 ++++++++++++++++++++++------- components/dateSelect.js | 11 ++--------- components/driver.js | 18 ------------------ components/reason.js | 21 +++++++++++++++------ components/wizard.js | 6 +++--- 5 files changed, 42 insertions(+), 43 deletions(-) delete mode 100644 components/driver.js diff --git a/components/contact.js b/components/contact.js index 1e2d95f..7207053 100644 --- a/components/contact.js +++ b/components/contact.js @@ -5,32 +5,47 @@ import Form from 'react-bootstrap/Form' import Col from 'react-bootstrap/Col' export default function Contact() { - const { state, dispatch } = useContext(WizardContext) + const { state } = useContext(WizardContext) - const { multipleDays, startDate, endDate } = state + const { name, email, street, zip, city } = state return ( <> Name - + E-Mail - + Straße - + PLZ - + Stadt - + diff --git a/components/dateSelect.js b/components/dateSelect.js index a56edec..5b449a6 100644 --- a/components/dateSelect.js +++ b/components/dateSelect.js @@ -1,5 +1,5 @@ import { useContext } from 'react' -import useSWR, { SWRConfig } from 'swr' +import useSWR from 'swr' import { WizardContext, ACTIONS } from '../context/wizardStore' @@ -18,14 +18,7 @@ export default function DateSelect() { fetcher ) - const { - multipleDays, - startDate, - endDate, - focusedInput, - pickupTime, - dropoffTime, - } = state + const { multipleDays, startDate, endDate, focusedInput } = state function isDayBlocked(momentDay) { return ( diff --git a/components/driver.js b/components/driver.js deleted file mode 100644 index ddb9069..0000000 --- a/components/driver.js +++ /dev/null @@ -1,18 +0,0 @@ -export default function Driver({}) { - return ( - <> -
- - - - -
-
- - - - -
- - ) -} diff --git a/components/reason.js b/components/reason.js index a9f8d2a..b6cdc78 100644 --- a/components/reason.js +++ b/components/reason.js @@ -2,26 +2,35 @@ import { useContext } from 'react' import { WizardContext, ACTIONS } from '../context/wizardStore' import Form from 'react-bootstrap/Form' -import Col from 'react-bootstrap/Col' export default function Contact() { - const { state, dispatch } = useContext(WizardContext) + const { state } = useContext(WizardContext) - const { multipleDays, startDate, endDate } = state + const { purpose, destination, org } = state return ( <> Zweck der Fahrt - + Verein - + Ziel der Fahrt - + ) diff --git a/components/wizard.js b/components/wizard.js index 325927d..c6b9fef 100644 --- a/components/wizard.js +++ b/components/wizard.js @@ -23,6 +23,8 @@ function WizardInternal() { const isFirstStep = currentStep === 0 const isLastStep = currentStep === STEPS.length - 1 + const CurrentStepComponent = STEPS[currentStep].component + return (
{ @@ -41,9 +43,7 @@ function WizardInternal() { onSubmit() }} > - {STEPS.map(({ id, component: Component }, index) => ( - <>{currentStep === index && } - ))} + {!isFirstStep && (