|
@@ -1,21 +1,37 @@
|
|
|
import { Tooltip } from "antd";
|
|
import { Tooltip } from "antd";
|
|
|
import { IWbw } from "./WbwWord";
|
|
import { IWbw } from "./WbwWord";
|
|
|
import { Dict2SvgIcon } from "../../../assets/icon";
|
|
import { Dict2SvgIcon } from "../../../assets/icon";
|
|
|
|
|
+import { errorClass } from "./WbwMeaning";
|
|
|
|
|
|
|
|
interface IWidget {
|
|
interface IWidget {
|
|
|
data: IWbw;
|
|
data: IWbw;
|
|
|
|
|
+ answer?: IWbw;
|
|
|
}
|
|
}
|
|
|
-const WbwParentIcon = ({ data }: IWidget) => {
|
|
|
|
|
- return data.parent?.value ? (
|
|
|
|
|
|
|
+const WbwParentIcon = ({ data, answer }: IWidget) => {
|
|
|
|
|
+ const iconEmpty = answer?.parent ? <Dict2SvgIcon /> : <></>;
|
|
|
|
|
+ let title: string | null | undefined = "空";
|
|
|
|
|
+ if (typeof data.parent?.value === "string" && data.parent?.value.length > 0) {
|
|
|
|
|
+ title = data.parent?.value;
|
|
|
|
|
+ }
|
|
|
|
|
+ const icon = data.parent?.value ? (
|
|
|
data.parent.value.trim() !== "" ? (
|
|
data.parent.value.trim() !== "" ? (
|
|
|
- <Tooltip title={data.parent?.value}>
|
|
|
|
|
|
|
+ <Tooltip title={title}>
|
|
|
<Dict2SvgIcon />
|
|
<Dict2SvgIcon />
|
|
|
</Tooltip>
|
|
</Tooltip>
|
|
|
) : (
|
|
) : (
|
|
|
- <></>
|
|
|
|
|
|
|
+ iconEmpty
|
|
|
)
|
|
)
|
|
|
) : (
|
|
) : (
|
|
|
- <></>
|
|
|
|
|
|
|
+ iconEmpty
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ const errClass = answer
|
|
|
|
|
+ ? errorClass("parent", data.parent?.value, answer?.parent?.value)
|
|
|
|
|
+ : "";
|
|
|
|
|
+ return (
|
|
|
|
|
+ <span className={"wbw_word_item" + errClass}>
|
|
|
|
|
+ <span className="icon">{icon}</span>
|
|
|
|
|
+ </span>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|