Conference selection
This commit is contained in:
parent
cba2439f11
commit
ff715b610b
|
@ -0,0 +1,13 @@
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
export default function Schedule({
|
||||||
|
conferenceId,
|
||||||
|
}) {
|
||||||
|
return (<>
|
||||||
|
conference id: {conferenceId}
|
||||||
|
</>);
|
||||||
|
}
|
||||||
|
|
||||||
|
Schedule.propTypes = {
|
||||||
|
conferenceId: PropTypes.string.isRequired,
|
||||||
|
};
|
|
@ -1,4 +1,6 @@
|
||||||
import useConferences from './hooks/useConferences.js';
|
import useConferences from './hooks/useConferences.js';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import Schedule from './Schedule.jsx';
|
||||||
|
|
||||||
export default function ScheduleLoader() {
|
export default function ScheduleLoader() {
|
||||||
const {
|
const {
|
||||||
|
@ -7,15 +9,20 @@ export default function ScheduleLoader() {
|
||||||
isLoading,
|
isLoading,
|
||||||
} = useConferences();
|
} = useConferences();
|
||||||
|
|
||||||
|
const [ conferenceId, setConferenceId ] = useState();
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
{isLoading && <p>Please wait...</p>}
|
{isLoading && <p>Please wait...</p>}
|
||||||
{error && <p>Error: {error}</p>}
|
{error && <p>Error: {error}</p>}
|
||||||
{conferences && <>
|
{conferences && <>
|
||||||
<label>Select a conference</label>
|
<label>Select a conference</label>
|
||||||
<select>
|
<select onChange={e => setConferenceId(e.target.value)}>
|
||||||
{conferences.map(conference => <option key={conference.id}
|
{conferences.map(conference => <option key={conference.id}
|
||||||
value={conference.id}>{conference.title}</option>)}
|
value={conference.id}>{conference.title}</option>)}
|
||||||
</select>
|
</select>
|
||||||
</>}
|
</>}
|
||||||
|
{conferenceId && <div>
|
||||||
|
<Schedule conferenceId={conferenceId} />
|
||||||
|
</div>}
|
||||||
</>);
|
</>);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue