import { useEffect, useState } from "react"; import { Layout, Affix, Col, Row } from "antd"; import SearchVocabulary from "../dict/SearchVocabulary"; import TermSearch from "./TermSearch"; const { Content } = Layout; interface IWidget { word?: string; wordId?: string; compact?: boolean; hideInput?: boolean; onSearch?: Function; onIdChange?: Function; } const TermShowWidget = ({ word, wordId, compact = false, hideInput = false, onSearch, onIdChange, }: IWidget) => { const [_split, setSplit] = useState(); const [wordSearch, setWordSearch] = useState(); const [container, setContainer] = useState(null); useEffect(() => { setWordSearch(word?.toLowerCase()); }, [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 (
{hideInput ? ( <> ) : ( container : undefined}>
{compact ? <> : } { console.log("onSplit", word); setSplit(word); }} /> {compact ? <> : }
)} {compact ? <> : } { console.debug("term onIdChange", value); if (typeof onIdChange !== "undefined") { onIdChange(value); } }} /> {compact ? <> : }
); }; export default TermShowWidget;