WbwDetailNote.tsx 764 B

123456789101112131415161718192021222324252627282930313233
  1. import { Input } from "antd";
  2. import type { IWbw } from "./WbwWord"
  3. const { TextArea } = Input;
  4. interface IWidget {
  5. data: IWbw;
  6. onChange?: Function;
  7. }
  8. const WbwDetailNoteWidget = ({ data, onChange }: IWidget) => {
  9. const onTextChange = (
  10. e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
  11. ) => {
  12. console.log("Change:", e.target.value);
  13. if (typeof onChange !== "undefined") {
  14. onChange({ field: "note", value: e.target.value });
  15. }
  16. };
  17. return (
  18. <>
  19. <TextArea
  20. defaultValue={data.note?.value ? data.note?.value : undefined}
  21. showCount
  22. maxLength={512}
  23. autoSize={{ minRows: 8, maxRows: 10 }}
  24. onChange={onTextChange}
  25. />
  26. </>
  27. );
  28. };
  29. export default WbwDetailNoteWidget;