import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import withStyles from '../styles/withStyles'; import { cloneChildrenWithClassName } from '../utils/reactHelpers'; export const styles = { root: { height: 52, display: 'flex', alignItems: 'center', padding: '2px 4px', boxSizing: 'border-box', }, action: { margin: '0 4px', }, }; function CardActions(props) { const { disableActionSpacing, children, classes, className, ...other } = props; return (
{disableActionSpacing ? children : cloneChildrenWithClassName(children, classes.action)}
); } 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, }; export default withStyles(styles, { name: 'MuiCardActions' })(CardActions);