WbwParent2.tsx 753 B

1234567891011121314151617181920212223242526272829303132
  1. import { Tag, Tooltip } from "antd";
  2. import { useIntl } from "react-intl";
  3. import type { IWbw } from "./WbwWord"
  4. interface IWidget {
  5. data: IWbw;
  6. }
  7. const WbwParent2Widget = ({ data }: IWidget) => {
  8. const intl = useIntl();
  9. return data.grammar2?.value ? (
  10. data.grammar2.value.trim() !== "" ? (
  11. <Tooltip title={data.parent2?.value}>
  12. <Tag color={"yellow"}>
  13. {intl.formatMessage({
  14. id:
  15. "dict.fields.type." +
  16. data.grammar2.value?.replaceAll(".", "") +
  17. ".short.label",
  18. defaultMessage: data.grammar2.value?.replaceAll(".", ""),
  19. })}
  20. </Tag>
  21. </Tooltip>
  22. ) : (
  23. <></>
  24. )
  25. ) : (
  26. <></>
  27. );
  28. };
  29. export default WbwParent2Widget;