mirror of
https://github.com/magnum-opus-tender-hack/frontend.git
synced 2024-11-22 00:06:35 +03:00
add spinner
This commit is contained in:
parent
28d080683e
commit
3fbc0580f5
|
@ -10,8 +10,10 @@ import styles from "./search.module.css"
|
||||||
export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
|
export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
|
||||||
const [data, setData] = useState("")
|
const [data, setData] = useState("")
|
||||||
const [tags, setTags] = useState(new Array<JSX.Element>())
|
const [tags, setTags] = useState(new Array<JSX.Element>())
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const getNodes = useAppSelector(nodes);
|
const getNodes = useAppSelector(nodes);
|
||||||
|
const getProducts = useAppSelector(products);
|
||||||
const getHints = useAppSelector(hints);
|
const getHints = useAppSelector(hints);
|
||||||
const [autoCompleteValue, setAutoCompleteValue] = useState("")
|
const [autoCompleteValue, setAutoCompleteValue] = useState("")
|
||||||
const onChange = (text:string) =>{
|
const onChange = (text:string) =>{
|
||||||
|
@ -67,6 +69,7 @@ export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
|
||||||
}
|
}
|
||||||
|
|
||||||
const onEnter = (value:any) => {
|
const onEnter = (value:any) => {
|
||||||
|
setLoading(true)
|
||||||
console.log(getNodes);
|
console.log(getNodes);
|
||||||
dispatch(
|
dispatch(
|
||||||
search(
|
search(
|
||||||
|
@ -127,6 +130,7 @@ export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
|
||||||
onSearch={(e) => onEnter(e)}
|
onSearch={(e) => onEnter(e)}
|
||||||
size="large"
|
size="large"
|
||||||
placeholder="Поиск товара"
|
placeholder="Поиск товара"
|
||||||
|
loading={loading && getProducts.length == 0}
|
||||||
enterButton />
|
enterButton />
|
||||||
</AutoComplete>
|
</AutoComplete>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user