diff --git a/components/wizard/contact.tsx b/components/wizard/contact.tsx index d172669..aa55507 100644 --- a/components/wizard/contact.tsx +++ b/components/wizard/contact.tsx @@ -1,6 +1,6 @@ import React, { useContext } from 'react' import { WizardContext } from './context/wizardStore' -import Required from './required' +import Input from './input' export default function Contact() { const { state, onChangeEvent } = useContext(WizardContext) @@ -9,77 +9,42 @@ export default function Contact() { return ( <> -
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - - - -
-
+ + + + + ) } diff --git a/components/wizard/dateSelect.tsx b/components/wizard/dateSelect.tsx index 1c3e3a2..971129b 100644 --- a/components/wizard/dateSelect.tsx +++ b/components/wizard/dateSelect.tsx @@ -7,7 +7,7 @@ import useSWR from 'swr' import { getNextBigger, getNextSmaller } from '../../helpers/array' import { dateFormatBackend } from '../../helpers/date' import { WizardContext } from './context/wizardStore' -import Required from './required' +import InputWrapper from './inputWrapper' const fetcher = (path: string) => fetch(path).then((r) => r.json()) @@ -70,65 +70,60 @@ export default function DateSelect() { } return ( -
-
- - setRange({ ...range, from })} - /> - {' - '} - setRange({ ...range, to })} - /> - -
-
+ + setRange({ ...range, from })} + /> + {' - '} + setRange({ ...range, to })} + /> + + ) } diff --git a/components/wizard/input.tsx b/components/wizard/input.tsx new file mode 100644 index 0000000..58bd44c --- /dev/null +++ b/components/wizard/input.tsx @@ -0,0 +1,17 @@ +import React from 'react' + +import InputWrapper from './inputWrapper' + +interface InputProps extends React.InputHTMLAttributes { + label: string +} + +export default function Input(props: InputProps) { + const { label, required, type = 'text', ...rest } = props + + return ( + + + + ) +} diff --git a/components/wizard/inputWrapper.tsx b/components/wizard/inputWrapper.tsx new file mode 100644 index 0000000..2d12e76 --- /dev/null +++ b/components/wizard/inputWrapper.tsx @@ -0,0 +1,23 @@ +import React from 'react' +import Required from './required' + +export default function Input(props: { + label: string + required: boolean + children: React.ReactChildren +}) { + const { label, required, children } = props + + return ( + <> +
+
+ + {children} +
+
+ + ) +} diff --git a/components/wizard/reason.tsx b/components/wizard/reason.tsx index 848377f..03689a2 100644 --- a/components/wizard/reason.tsx +++ b/components/wizard/reason.tsx @@ -1,59 +1,29 @@ import React, { useContext } from 'react' import { WizardContext } from './context/wizardStore' -import Required from './required' +import Input from './input' export default function Contact() { const { state, onChangeEvent } = useContext(WizardContext) - const { formDataChanged } = state const { purpose, destination, org } = state.formData return ( <> -
-
- - -
-
-
-
- - -
-
-
-
- - -
-
+ + + ) }