import React, { Component } from "react"; import Form from '@cloudscape-design/components/form'; import SpaceBetween from '@cloudscape-design/components/space-between'; import Button from '@cloudscape-design/components/button'; import FormField from '@cloudscape-design/components/form-field'; import Autosuggest from '@cloudscape-design/components/autosuggest'; import DatePicker from '@cloudscape-design/components/date-picker'; import Checkbox from '@cloudscape-design/components/checkbox'; import { SearchApi } from "../services/search-api.ts"; export interface SearchProps { Origin: string; Destination: string; OutboundDate: string; InboundDate?: string; WheelchairAvailability?: boolean; StationStatus?: string; } export class SearchForm extends Component { private readonly searchApi: SearchApi; private readonly successHandler: Function; public readonly state: SearchProps = { Origin: '', Destination: '', OutboundDate: '', StationStatus: 'finished' } public stations: any[] = []; constructor (props: any) { super(props); this.successHandler = props.onsubmit; this.stations = props.stations; } async setValue (prop: string, value: any) { this.setState({ [prop]: value }) } submitSearchRequest (event: any) { this.successHandler({ ...this.state }); event.preventDefault(); } render () { return (
) } }