material-ui
Version:
React Components that Implement Google's Material Design.
126 lines (96 loc) • 3.88 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _simpleAssign = require('simple-assign');
var _simpleAssign2 = _interopRequireDefault(_simpleAssign);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getStyles() {
return {
root: {
padding: 8,
position: 'relative'
},
action: {
marginRight: 8
}
};
}
var CardActions = function (_Component) {
(0, _inherits3.default)(CardActions, _Component);
function CardActions() {
(0, _classCallCheck3.default)(this, CardActions);
return (0, _possibleConstructorReturn3.default)(this, (CardActions.__proto__ || (0, _getPrototypeOf2.default)(CardActions)).apply(this, arguments));
}
(0, _createClass3.default)(CardActions, [{
key: 'render',
value: function render() {
var _props = this.props,
actAsExpander = _props.actAsExpander,
children = _props.children,
expandable = _props.expandable,
showExpandableButton = _props.showExpandableButton,
style = _props.style,
other = (0, _objectWithoutProperties3.default)(_props, ['actAsExpander', 'children', 'expandable', 'showExpandableButton', 'style']);
var prepareStyles = this.context.muiTheme.prepareStyles;
var styles = getStyles(this.props, this.context);
var styledChildren = _react2.default.Children.map(children, function (child) {
if (_react2.default.isValidElement(child)) {
return _react2.default.cloneElement(child, {
style: (0, _simpleAssign2.default)({}, styles.action, child.props.style)
});
}
});
return _react2.default.createElement(
'div',
(0, _extends3.default)({}, other, { style: prepareStyles((0, _simpleAssign2.default)(styles.root, style)) }),
styledChildren
);
}
}]);
return CardActions;
}(_react.Component);
CardActions.contextTypes = {
muiTheme: _propTypes2.default.object.isRequired
};
CardActions.propTypes = process.env.NODE_ENV !== "production" ? {
/**
* If true, a click on this card component expands the card.
*/
actAsExpander: _propTypes2.default.bool,
/**
* Can be used to render elements inside the Card Action.
*/
children: _propTypes2.default.node,
/**
* If true, this card component is expandable.
*/
expandable: _propTypes2.default.bool,
/**
* If true, this card component will include a button to expand the card.
*/
showExpandableButton: _propTypes2.default.bool,
/**
* Override the inline-styles of the root element.
*/
style: _propTypes2.default.object
} : {};
exports.default = CardActions;
;