Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -1,12 +1,10 @@
// @flow
import React from 'react';
import type { Node } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import '../Button'; // So we don't have any override priority issue.
export const styles = (theme: Object) => ({
export const styles = theme => ({
root: {
display: 'flex',
justifyContent: 'flex-end',
@@ -22,43 +20,41 @@ export const styles = (theme: Object) => ({
},
});
type ProvidedProps = {
classes: Object,
};
export type Props = {
/**
* The content of the component.
*/
children?: Node,
/**
* Useful to extend the style applied to components.
*/
classes?: Object,
/**
* @ignore
*/
className?: string,
};
function DialogActions(props: ProvidedProps & Props) {
function DialogActions(props) {
const { children, classes, className, ...other } = props;
return (
<div data-mui-test="DialogActions" className={classNames(classes.root, className)} {...other}>
{React.Children.map(
children,
button =>
React.isValidElement(button) && (
<div className={classes.action}>
{React.cloneElement(button, {
className: classNames(classes.button, button.props.className),
})}
</div>
),
)}
<div className={classNames(classes.root, className)} {...other}>
{React.Children.map(children, child => {
if (!React.isValidElement(child)) {
return null;
}
return (
<div className={classes.action}>
{React.cloneElement(child, {
className: classNames(classes.button, child.props.className),
})}
</div>
);
})}
</div>
);
}
DialogActions.propTypes = {
/**
* The content of the component.
*/
children: PropTypes.node,
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
};
export default withStyles(styles, { name: 'MuiDialogActions' })(DialogActions);