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,7 +1,5 @@
// @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 { cloneChildrenWithClassName } from '../utils/reactHelpers';
@@ -12,48 +10,42 @@ export const styles = {
display: 'flex',
alignItems: 'center',
padding: '2px 4px',
boxSizing: 'border-box',
},
actionSpacing: {
action: {
margin: '0 4px',
},
};
type ProvidedProps = {
classes: Object,
disableActionSpacing: boolean,
};
export type Props = {
/**
* The content of the component.
*/
children?: Node,
/**
* Useful to extend the style applied to components.
*/
classes?: Object,
/**
* @ignore
*/
className?: string,
/**
* If `true`, the card actions do not have additional margin.
*/
disableActionSpacing?: boolean,
};
function CardActions(props: ProvidedProps & Props) {
function CardActions(props) {
const { disableActionSpacing, children, classes, className, ...other } = props;
return (
<div className={classNames(classes.root, className)} {...other}>
{disableActionSpacing
? children
: cloneChildrenWithClassName(children, classes.actionSpacing)}
{disableActionSpacing ? children : cloneChildrenWithClassName(children, classes.action)}
</div>
);
}
CardActions.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,
/**
* If `true`, the card actions do not have additional margin.
*/
disableActionSpacing: PropTypes.bool,
};
CardActions.defaultProps = {
disableActionSpacing: false,
};