Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
shivani170 committed Dec 11, 2023
1 parent 6fe0bb9 commit a1ca7bf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "0.0.45-beta-10",
"version": "0.0.45-beta-11",
"description": "Supporting common component library",
"main": "dist/index.js",
"scripts": {
Expand Down
28 changes: 16 additions & 12 deletions src/Common/CustomInput/CustomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export function CustomInput({
state,
handleBlurChange
}: CustomInputProps) {
const [stateForm, setStateForm] = useState(state)

const renderLabelHelperText = () => {
return (
Expand All @@ -53,17 +52,22 @@ export function CustomInput({
}

const handleOnBlur = (event) => {
if(typeof handleBlurChange === 'function') {
handleBlurChange(event)
}
console.log('event', event)

if (stateForm) {
console.log('stateForm', stateForm)
setStateForm((prevState) => ({
...prevState,
[event.target.name]: event.target.value.trim(),
}))

onChange({
...event,
target: {
...event.target,
value: event.target.value.trim(),
},
})
if (typeof handleBlurChange === 'function') {
handleBlurChange({
...event,
target: {
...event.target,
value: event.target.value.trim(),
},
})
}

}
Expand Down

0 comments on commit a1ca7bf

Please sign in to comment.