demarches-normaliennes/app/javascript/components/ComboCommunesSearch.jsx

25 lines
633 B
React
Raw Normal View History

2020-10-07 17:42:41 +02:00
import React from 'react';
2021-02-16 13:54:16 +01:00
import { QueryClientProvider } from 'react-query';
2020-10-07 17:42:41 +02:00
import ComboSearch from './ComboSearch';
2021-02-16 13:54:16 +01:00
import { queryClient } from './shared/queryClient';
2020-10-07 17:42:41 +02:00
function ComboCommunesSearch(params) {
return (
2021-02-16 13:54:16 +01:00
<QueryClientProvider client={queryClient}>
2020-10-07 17:42:41 +02:00
<ComboSearch
required={params.mandatory}
hiddenFieldId={params.hiddenFieldId}
scope="communes"
minimumInputLength={2}
transformResult={({ code, nom, codesPostaux }) => [
code,
`${nom} (${codesPostaux[0]})`
]}
/>
2021-02-16 13:54:16 +01:00
</QueryClientProvider>
2020-10-07 17:42:41 +02:00
);
}
export default ComboCommunesSearch;