Skip to content

Commit fa3eee0

Browse files
committed
feat: add component prop in SimpleTwoActionsDialog
1 parent 6760c6c commit fa3eee0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/dialogs/SimpleTwoActionsDialog/SimpleTwoActionsDialog.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const SimpleTwoActionsDialog = ({
1515
button1Props,
1616
button2Props,
1717
closeOnBackdropClick,
18+
component,
1819
}) => {
1920
const onClose = (event, reason) => {
2021
if (closeOnBackdropClick || reason !== 'backdropClick') {
@@ -33,7 +34,9 @@ export const SimpleTwoActionsDialog = ({
3334
>
3435
<DialogTitle id={id + '-dialog-title'}>{labels.title}</DialogTitle>
3536
<DialogContent>
36-
<Typography variant="body1">{labels.body}</Typography>
37+
<Typography variant="body1" component={component}>
38+
{labels.body}
39+
</Typography>
3740
</DialogContent>
3841
<DialogActions>
3942
<Button
@@ -84,7 +87,7 @@ SimpleTwoActionsDialog.propTypes = {
8487
*/
8588
labels: PropTypes.shape({
8689
title: PropTypes.string.isRequired,
87-
body: PropTypes.string.isRequired,
90+
body: PropTypes.node.isRequired,
8891
button1: PropTypes.string.isRequired,
8992
button2: PropTypes.string.isRequired,
9093
}),
@@ -117,6 +120,10 @@ SimpleTwoActionsDialog.propTypes = {
117120
* Close dialog on backdrop click
118121
*/
119122
closeOnBackdropClick: PropTypes.bool,
123+
/**
124+
* HTML tag to be rendered as dialog's body, e.g., 'div', 'span', 'p' (default value)
125+
*/
126+
component: PropTypes.string,
120127
};
121128

122129
SimpleTwoActionsDialog.defaultProps = {
@@ -139,4 +146,5 @@ SimpleTwoActionsDialog.defaultProps = {
139146
button1Props: {},
140147
button2Props: {},
141148
closeOnBackdropClick: false,
149+
component: 'p',
142150
};

0 commit comments

Comments
 (0)