Skip to content

Commit

Permalink
feat: add component prop in SimpleTwoActionsDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
esasova committed Oct 23, 2023
1 parent 6760c6c commit fa3eee0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/dialogs/SimpleTwoActionsDialog/SimpleTwoActionsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const SimpleTwoActionsDialog = ({
button1Props,
button2Props,
closeOnBackdropClick,
component,
}) => {
const onClose = (event, reason) => {
if (closeOnBackdropClick || reason !== 'backdropClick') {
Expand All @@ -33,7 +34,9 @@ export const SimpleTwoActionsDialog = ({
>
<DialogTitle id={id + '-dialog-title'}>{labels.title}</DialogTitle>
<DialogContent>
<Typography variant="body1">{labels.body}</Typography>
<Typography variant="body1" component={component}>
{labels.body}
</Typography>
</DialogContent>
<DialogActions>
<Button
Expand Down Expand Up @@ -84,7 +87,7 @@ SimpleTwoActionsDialog.propTypes = {
*/
labels: PropTypes.shape({
title: PropTypes.string.isRequired,
body: PropTypes.string.isRequired,
body: PropTypes.node.isRequired,
button1: PropTypes.string.isRequired,
button2: PropTypes.string.isRequired,
}),
Expand Down Expand Up @@ -117,6 +120,10 @@ SimpleTwoActionsDialog.propTypes = {
* Close dialog on backdrop click
*/
closeOnBackdropClick: PropTypes.bool,
/**
* HTML tag to be rendered as dialog's body, e.g., 'div', 'span', 'p' (default value)
*/
component: PropTypes.string,
};

SimpleTwoActionsDialog.defaultProps = {
Expand All @@ -139,4 +146,5 @@ SimpleTwoActionsDialog.defaultProps = {
button1Props: {},
button2Props: {},
closeOnBackdropClick: false,
component: 'p',
};

0 comments on commit fa3eee0

Please sign in to comment.