mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
nominatim search (without working dialog)
This commit is contained in:
parent
c3e136cebb
commit
b20a3445d1
27 changed files with 450 additions and 61 deletions
37
src/components/dialogs/NominatimSearchPanel.tsx
Normal file
37
src/components/dialogs/NominatimSearchPanel.tsx
Normal file
|
@ -0,0 +1,37 @@
|
|||
import React, { FC, useCallback, useState } from 'react';
|
||||
import { Icon } from '../panels/Icon';
|
||||
|
||||
interface IProps {
|
||||
active: boolean;
|
||||
onSearch: (search: string) => void;
|
||||
}
|
||||
|
||||
const NominatimSearchPanel: FC<IProps> = ({ active, onSearch }) => {
|
||||
const [search, setSearch] = useState('Колывань');
|
||||
|
||||
const setValue = useCallback(({ target: { value } }) => setSearch(value), [setSearch]);
|
||||
|
||||
const onSubmit = useCallback(event => {
|
||||
event.preventDefault();
|
||||
|
||||
if (search.length < 3) return;
|
||||
|
||||
onSearch(search);
|
||||
}, [search, onSearch]);
|
||||
|
||||
return (
|
||||
<form className="panel nominatim-panel active" onSubmit={onSubmit}>
|
||||
<div className="control-bar">
|
||||
<div className="nominatim-search-input">
|
||||
<input type="text" placeholder="Поиск на карте" value={search} onChange={setValue} />
|
||||
</div>
|
||||
|
||||
<button>
|
||||
<Icon icon="icon-search" />
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
|
||||
export { NominatimSearchPanel };
|
Loading…
Add table
Add a link
Reference in a new issue