import React, { useState, forwardRef } from "react";
// import { Icon } from 'umi'
import { Input } from "antd";

type CompoundedComponent = React.ForwardRefExoticComponent<{
  label: string;
}> & {
  name: string;
  icon: string;
};
const Text = forwardRef((prpps, ref) => {
  const [value, setValue] = useState(prpps.label);
  const [editMode, setEditMode] = useState(true);

  return (
    <>
      editMode ?{" "}
      <Input value={value} onChange={(e) => setValue(e.target.value)} />:{" "}
      <span onDoubleClick={() => setEditMode(true)}>{value}</span>
    </>
  );
}) as CompoundedComponent;

Text.name = "文本";
Text.icon = require('./image/text.svg').default;

export default Text;
