Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-frontend
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
coding-brunch-hh
inventory-frontend
Commits
d60030a1
Commit
d60030a1
authored
Aug 13, 2018
by
Martin Fahl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactors onChange calls
parent
42dfaf41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/components/AddDialog/AddDialog.js
src/components/AddDialog/AddDialog.js
+5
-4
src/container/AddDialogContainer/AddDialogContainer.js
src/container/AddDialogContainer/AddDialogContainer.js
+2
-2
No files found.
src/components/AddDialog/AddDialog.js
View file @
d60030a1
import
React
from
"
react
"
;
import
PropTypes
from
"
prop-types
"
;
import
{
Button
,
TextField
,
Dialog
,
DialogActions
,
DialogContent
,
DialogTitle
,
Grid
}
from
'
@material-ui/core/
'
;
const
AddDialog
=
({
name
,
quantity
,
isOpen
,
handleClose
,
handleCancel
,
handleAdd
,
updateName
,
updateQuantity
})
=>
(
<
Dialog
open
=
{
isOpen
}
...
...
@@ -19,7 +19,7 @@ const AddDialog = ({ name, quantity, isOpen, handleClose, handleCancel, handleAd
id
=
"
name
"
label
=
"
Name
"
type
=
"
string
"
onChange
=
{
updateName
}
onChange
=
{
(
event
)
=>
updateName
(
event
.
target
.
value
)
}
/
>
<
/Grid
>
<
Grid
item
>
...
...
@@ -28,7 +28,8 @@ const AddDialog = ({ name, quantity, isOpen, handleClose, handleCancel, handleAd
id
=
"
quantity
"
label
=
"
Quantity
"
type
=
"
number
"
onChange
=
{
updateQuantity
}
value
=
{
quantity
}
onChange
=
{(
event
)
=>
updateQuantity
(
event
.
target
.
value
)}
/
>
<
/Grid
>
<
/Grid
>
...
...
@@ -52,6 +53,6 @@ AddDialog.propTypes = {
handleClose
:
PropTypes
.
func
.
isRequired
,
handleCancel
:
PropTypes
.
func
.
isRequired
,
handleAdd
:
PropTypes
.
func
.
isRequired
}
;
}
export
default
AddDialog
\ No newline at end of file
src/container/AddDialogContainer/AddDialogContainer.js
View file @
d60030a1
...
...
@@ -43,8 +43,8 @@ const mapDispatchToProps = (dispatch) => ({
handleClose
:
()
=>
dispatch
(
closeAddDialog
()),
handleCancel
:
()
=>
dispatch
(
closeAddDialog
()),
handleAdd
:
(
name
,
quantity
)
=>
handleAdd
(
name
,
quantity
,
dispatch
),
updateName
:
event
=>
dispatch
(
updateAddDialogName
(
event
.
target
.
valu
e
)),
updateQuantity
:
event
=>
dispatch
(
updateAddDialogQuantity
(
Number
(
event
.
target
.
value
)))
updateName
:
newName
=>
dispatch
(
updateAddDialogName
(
newNam
e
)),
updateQuantity
:
newQuantity
=>
dispatch
(
updateAddDialogQuantity
(
Number
(
newQuantity
)))
})
export
default
connect
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment