import { h } from 'preact'; import PropTypes from 'prop-types'; import { organizationPropType } from '../src/components/common-prop-types'; const orgOptions = (organizations, organizationId) => { const orgs = organizations.map(organization => { if (organizationId === organization.id) { return ( ); } return ; }); const nullOrgOption = organizationId === null ? ( ) : ( ); return [nullOrgOption, ...orgs]; }; export const OrganizationPicker = ({ name, id, organizations, organizationId, onToggle, }) => ( ); OrganizationPicker.propTypes = { name: PropTypes.string.isRequired, id: PropTypes.string.isRequired, onToggle: PropTypes.func.isRequired, organizationId: PropTypes.number.isRequired, organizations: PropTypes.arrayOf(organizationPropType).isRequired, };