mirror of
https://github.com/magnum-opus-tender-hack/frontend.git
synced 2024-11-24 17:23:43 +03:00
add cats
This commit is contained in:
parent
61b4b4282c
commit
383c3bb5b0
|
@ -26,3 +26,7 @@ a {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar{
|
||||||
|
display: none;
|
||||||
|
}
|
|
@ -1,11 +1,15 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { AutoComplete, Input, Tag } from 'antd';
|
import { AutoComplete, Input, Tag, Tooltip } from 'antd';
|
||||||
import { useAppDispatch, useAppSelector } from "../../hooks";
|
import { useAppDispatch, useAppSelector } from "../../hooks";
|
||||||
import { createNode, deleteNode, hints, INode, nodes, products } from "../../store/reducers/nodesInputReducer";
|
import { createNode, deleteNode, hints, INode, nodes, products } from "../../store/reducers/nodesInputReducer";
|
||||||
import { createHints, search } from "../../store/reducers/asyncActions";
|
import { createHints, search } from "../../store/reducers/asyncActions";
|
||||||
import styles from "./search.module.css"
|
import styles from "./search.module.css"
|
||||||
|
|
||||||
|
function parse_types(type: string) {
|
||||||
|
if (type == 'Name') return 'Наименование'
|
||||||
|
if (type == 'Category') return 'Категория'
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
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("")
|
||||||
|
@ -107,11 +111,13 @@ export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
|
||||||
const after_str = e.value.value.slice(e.coordinate+autoCompleteValue.length, e.value.value.length)
|
const after_str = e.value.value.slice(e.coordinate+autoCompleteValue.length, e.value.value.length)
|
||||||
const bold_str = e.value.value.slice(e.coordinate, e.coordinate+autoCompleteValue.length)
|
const bold_str = e.value.value.slice(e.coordinate, e.coordinate+autoCompleteValue.length)
|
||||||
return {
|
return {
|
||||||
label: <div>
|
label: <Tooltip title={parse_types(e.value.type)} placement={'topRight'}>
|
||||||
|
<div>
|
||||||
<span>{pre_str}</span>
|
<span>{pre_str}</span>
|
||||||
{bold_str.toLocaleLowerCase () == autoCompleteValue.toLowerCase() ? <strong>{bold_str}</strong> : <span>{bold_str}</span>}
|
{bold_str.toLocaleLowerCase () == autoCompleteValue.toLowerCase() ? <strong>{bold_str}</strong> : <span>{bold_str}</span>}
|
||||||
<span>{after_str}</span>
|
<span>{after_str}</span>
|
||||||
</div>,
|
</div>
|
||||||
|
</Tooltip>,
|
||||||
value: e.value.value + '--' + e.value.type
|
value: e.value.value + '--' + e.value.type
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user