Skip to content

Commit

Permalink
fix(InputButton): remove unnecessary code (#2011)
Browse files Browse the repository at this point in the history
* fix(InputButton): remove unnecessary code

* fix(InputButton): remove disabled

Co-authored-by: Zhang Rui <zhangrui@growingio.com>
  • Loading branch information
Ryan Zhang and Zhang Rui committed May 13, 2022
1 parent 4c102d1 commit b6d7180
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
17 changes: 2 additions & 15 deletions src/input/InputButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,12 @@ const InputButton = React.forwardRef<HTMLInputElement, InputButtonProps>((props,

const onClear = useCallback(
(event: React.MouseEvent<Element, MouseEvent>) => {
if (disabled) {
return;
}
handleOnClear?.(event);
onInputChange?.('');
onInputChange('');
setValue('');
event.stopPropagation();
},
[disabled, handleOnClear, onInputChange, setValue]
);

const onChange = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
const inputValue = e.target.value;
onInputChange?.(inputValue);
setValue(inputValue);
},
[onInputChange, setValue]
[handleOnClear, onInputChange, setValue]
);

const wrapperCls = useMemo(
Expand Down Expand Up @@ -91,7 +79,6 @@ const InputButton = React.forwardRef<HTMLInputElement, InputButtonProps>((props,
// when set Input type=button, the placeholder is invalid
value={value || placeholder}
title={value as string}
onChange={onChange}
prefix={customizePrefix}
suffix={suffix}
ref={ref}
Expand Down
9 changes: 3 additions & 6 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"module": "ES2015",
"target": "es5",
"jsx": "react",
"esModuleInterop": true,
"esModuleInterop": true
},
"include": [
"./src/**/*",
"./src/typings/index.d.ts",
]
}
"include": ["./src/**/*", "./src/typings/index.d.ts"]
}

1 comment on commit b6d7180

@vercel
Copy link

@vercel vercel bot commented on b6d7180 May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

gio-design – ./

gio-design.vercel.app
gio-design-growingio.vercel.app
gio-design-git-master-growingio.vercel.app

Please sign in to comment.