Skip to content

Commit 4dabe25

Browse files
[Dialog] Simplify the DialogContentText implementation (#12577)
1 parent 0395ee2 commit 4dabe25

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

packages/material-ui/src/DialogContentText/DialogContentText.js

+4-22
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,16 @@
22

33
import React from 'react';
44
import PropTypes from 'prop-types';
5-
import classNames from 'classnames';
65
import withStyles from '../styles/withStyles';
76
import Typography from '../Typography';
87

9-
export const styles = theme => ({
8+
export const styles = {
109
/* Styles applied to the root element. */
11-
root: {
12-
color: theme.palette.text.secondary,
13-
},
14-
});
10+
root: {},
11+
};
1512

1613
function DialogContentText(props) {
17-
const { children, classes, className, ...other } = props;
18-
19-
return (
20-
<Typography
21-
component="p"
22-
variant="subheading"
23-
className={classNames(classes.root, className)}
24-
{...other}
25-
>
26-
{children}
27-
</Typography>
28-
);
14+
return <Typography component="p" variant="subheading" color="textSecondary" {...props} />;
2915
}
3016

3117
DialogContentText.propTypes = {
@@ -38,10 +24,6 @@ DialogContentText.propTypes = {
3824
* See [CSS API](#css-api) below for more details.
3925
*/
4026
classes: PropTypes.object.isRequired,
41-
/**
42-
* @ignore
43-
*/
44-
className: PropTypes.string,
4527
};
4628

4729
export default withStyles(styles, { name: 'MuiDialogContentText' })(DialogContentText);

packages/material-ui/src/DialogContentText/DialogContentText.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ describe('<DialogContentText />', () => {
1717
describe('prop: className', () => {
1818
it('should render with the user and root classes', () => {
1919
const wrapper = shallow(<DialogContentText className="woofDialogContentText" />);
20-
assert.strictEqual(wrapper.hasClass('woofDialogContentText'), true);
21-
assert.strictEqual(wrapper.hasClass(classes.root), true);
20+
assert.strictEqual(wrapper.props().className, 'woofDialogContentText');
21+
assert.strictEqual(wrapper.props().classes.root, classes.root);
2222
});
2323
});
2424

0 commit comments

Comments
 (0)