Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dialog] Simplify the DialogContentText implementation #12577

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions packages/material-ui/src/DialogContentText/DialogContentText.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,16 @@

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import Typography from '../Typography';

export const styles = theme => ({
export const styles = {
/* Styles applied to the root element. */
root: {
color: theme.palette.text.secondary,
},
});
root: {},
};

function DialogContentText(props) {
const { children, classes, className, ...other } = props;

return (
<Typography
component="p"
variant="subheading"
className={classNames(classes.root, className)}
{...other}
>
{children}
</Typography>
);
return <Typography component="p" variant="subheading" color="textSecondary" {...props} />;
}

DialogContentText.propTypes = {
Expand All @@ -38,10 +24,6 @@ DialogContentText.propTypes = {
* See [CSS API](#css-api) below for more details.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
};

export default withStyles(styles, { name: 'MuiDialogContentText' })(DialogContentText);
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe('<DialogContentText />', () => {
describe('prop: className', () => {
it('should render with the user and root classes', () => {
const wrapper = shallow(<DialogContentText className="woofDialogContentText" />);
assert.strictEqual(wrapper.hasClass('woofDialogContentText'), true);
assert.strictEqual(wrapper.hasClass(classes.root), true);
assert.strictEqual(wrapper.props().className, 'woofDialogContentText');
assert.strictEqual(wrapper.props().classes.root, classes.root);
});
});

Expand Down