|
@@ -22,7 +22,14 @@ const Widget = ({ word, compact = false, onSearch }: IWidget) => {
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
setWordSearch(word?.toLowerCase());
|
|
setWordSearch(word?.toLowerCase());
|
|
|
}, [word]);
|
|
}, [word]);
|
|
|
-
|
|
|
|
|
|
|
+ const dictSearch = (value: string, isFactor?: boolean) => {
|
|
|
|
|
+ console.log("onSearch", value);
|
|
|
|
|
+ const word = value.toLowerCase();
|
|
|
|
|
+ setWordSearch(word);
|
|
|
|
|
+ if (typeof onSearch !== "undefined") {
|
|
|
|
|
+ onSearch(value, isFactor);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
return (
|
|
return (
|
|
|
<div ref={setContainer}>
|
|
<div ref={setContainer}>
|
|
|
<Affix offsetTop={0} target={compact ? () => container : undefined}>
|
|
<Affix offsetTop={0} target={compact ? () => container : undefined}>
|
|
@@ -37,14 +44,7 @@ const Widget = ({ word, compact = false, onSearch }: IWidget) => {
|
|
|
<Col flex="560px">
|
|
<Col flex="560px">
|
|
|
<SearchVocabulary
|
|
<SearchVocabulary
|
|
|
value={word}
|
|
value={word}
|
|
|
- onSearch={(value: string, isFactor?: boolean) => {
|
|
|
|
|
- console.log("onSearch", value);
|
|
|
|
|
- const word = value.toLowerCase();
|
|
|
|
|
- setWordSearch(word);
|
|
|
|
|
- if (typeof onSearch !== "undefined") {
|
|
|
|
|
- onSearch(value, isFactor);
|
|
|
|
|
- }
|
|
|
|
|
- }}
|
|
|
|
|
|
|
+ onSearch={dictSearch}
|
|
|
onSplit={(word: string | undefined) => {
|
|
onSplit={(word: string | undefined) => {
|
|
|
console.log("onSplit", word);
|
|
console.log("onSplit", word);
|
|
|
setSplit(word);
|
|
setSplit(word);
|
|
@@ -59,7 +59,7 @@ const Widget = ({ word, compact = false, onSearch }: IWidget) => {
|
|
|
<Row>
|
|
<Row>
|
|
|
{compact ? <></> : <Col flex="auto"></Col>}
|
|
{compact ? <></> : <Col flex="auto"></Col>}
|
|
|
<Col flex="1260px">
|
|
<Col flex="1260px">
|
|
|
- <Compound word={wordSearch} add={split} />
|
|
|
|
|
|
|
+ <Compound word={wordSearch} add={split} onSearch={dictSearch} />
|
|
|
<DictSearch word={wordSearch} compact={compact} />
|
|
<DictSearch word={wordSearch} compact={compact} />
|
|
|
</Col>
|
|
</Col>
|
|
|
{compact ? <></> : <Col flex="auto"></Col>}
|
|
{compact ? <></> : <Col flex="auto"></Col>}
|