import React, { useState } from 'react'; import SearchableSelect from '@/components/elements/SearchableSelect'; import searchDatabases from '@/api/admin/databases/searchDatabases'; import { Database } from '@/api/admin/databases/getDatabases'; import tw from 'twin.macro'; export default () => { const [ database, setDatabase ] = useState(null); const [ databases, setDatabases ] = useState([]); const onSearch = (query: string): Promise => { return new Promise((resolve, reject) => { searchDatabases({ name: query }).then((databases) => { setDatabases(databases); return resolve(); }).catch(reject); }); }; const onSelect = (database: Database) => { setDatabase(database); }; return ( {databases.map(d => ( d.id === database?.id ?
  • { e.stopPropagation(); // selectItem(d); }} >
    {d.name}
  • :
  • { e.stopPropagation(); // selectItem(d); }} >
    {d.name}
  • ))}
    ); };