Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Patrik Meijer
react-components
Commits
ec3d2b51
Commit
ec3d2b51
authored
Sep 18, 2018
by
Patrik Meijer
Browse files
Add ConfirmDialog
parent
e35f77ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/ConfirmDialog/ConfirmDialog.jsx
0 → 100644
View file @
ec3d2b51
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
Button
from
'
@material-ui/core/Button
'
;
import
Dialog
from
'
@material-ui/core/Dialog
'
;
import
DialogActions
from
'
@material-ui/core/DialogActions
'
;
import
DialogContent
from
'
@material-ui/core/DialogContent
'
;
import
DialogContentText
from
'
@material-ui/core/DialogContentText
'
;
import
DialogTitle
from
'
@material-ui/core/DialogTitle
'
;
function
ConfirmDialog
(
props
)
{
return
(
<
div
>
<
Dialog
open
onClose
=
{
()
=>
props
.
onClose
(
false
)
}
aria
-
labelledby
=
"alert-dialog-title"
aria
-
describedby
=
"alert-dialog-description"
>
<
DialogTitle
id
=
"alert-dialog-title"
>
{
props
.
title
}
</
DialogTitle
>
<
DialogContent
>
<
DialogContentText
id
=
"alert-dialog-description"
>
{
props
.
message
}
</
DialogContentText
>
</
DialogContent
>
<
DialogActions
>
<
Button
onClick
=
{
()
=>
props
.
onClose
(
false
)
}
color
=
"primary"
>
{
props
.
noButtonText
}
</
Button
>
<
Button
onClick
=
{
()
=>
props
.
onClose
(
true
)
}
color
=
"primary"
autoFocus
>
{
props
.
yesButtonText
}
</
Button
>
</
DialogActions
>
</
Dialog
>
</
div
>
);
}
ConfirmDialog
.
propTypes
=
{
title
:
PropTypes
.
string
.
isRequired
,
message
:
PropTypes
.
string
.
isRequired
,
noButtonText
:
PropTypes
.
string
,
yesButtonText
:
PropTypes
.
string
,
onClose
:
PropTypes
.
func
,
};
ConfirmDialog
.
defaultProps
=
{
onClose
:
(
ok
)
=>
{
console
.
log
(
`OK was
${
ok
?
''
:
'
not
'
}
pressed`
);
},
noButtonText
:
'
Cancel
'
,
yesButtonText
:
'
OK
'
,
};
export
default
ConfirmDialog
;
src/components/ConfirmDialog/index.js
0 → 100644
View file @
ec3d2b51
export
{
default
}
from
'
./ConfirmDialog
'
;
\ No newline at end of file
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