move contexts all out in own toplevel dir

- rename wizard to book
This commit is contained in:
Thomas Ruoff
2021-06-07 23:51:32 +02:00
parent 92477e5325
commit dbe3904759
10 changed files with 35 additions and 35 deletions

View File

@@ -0,0 +1,55 @@
import React, { useContext } from 'react'
import { BookContext } from '../../context/book'
import InputWrapper from '../inputWrapper'
import Calendar from '../calendar'
export default function DateSelect() {
const { onChangeEvent, onChange, state } = useContext(BookContext)
const { startDate, endDate } = state.formData
const today = new Date().toISOString().substring(0, 10)
return (
<>
<InputWrapper label="Datum" required>
<Calendar
start={startDate}
end={endDate}
onChange={onChange}
className="my-6 max-w-lg"
/>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="">
<label className="flabel inline-block mr-3" htmlFor="startDate">
Von
</label>
<input
required
type="date"
className="input-text"
name="startDate"
value={startDate || ''}
onChange={onChangeEvent}
min={today}
/>
</div>
<div className="">
<label className="flabel inline-block mr-3" htmlFor="endDate">
Bis
</label>
<input
required
type="date"
className="input-text"
name="endDate"
value={endDate || ''}
placeholder="Von"
onChange={onChangeEvent}
min={startDate || today}
/>
</div>
</div>
</InputWrapper>
</>
)
}