UNPKG

@krowdy-ui/core

Version:

React components that implement Google's Material Design.

102 lines (92 loc) 2.9 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["shadow"], _excluded2 = ["className", "classes", "shadow"]; // export { default } from '@material-ui/core/CardHeader' import React from 'react'; import MuiCardHeader from '@material-ui/core/CardHeader'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import { withStyles } from '@krowdy-ui/styles'; export var styles = function styles(theme) { return { action: {}, avatar: {}, content: {}, root: {}, shadow: { borderBottom: "1px solid ".concat(theme.palette.grey[300]), boxShadow: theme.shadows[1], padding: theme.spacing(1.25, 2) }, subheader: {}, title: {} }; }; var CardHeader = React.forwardRef(function CardHeader(props, ref) { var classNameProps = props.className, _props$classes = props.classes, shadowClass = _props$classes.shadow, classes = _objectWithoutProperties(_props$classes, _excluded), _props$shadow = props.shadow, shadow = _props$shadow === void 0 ? false : _props$shadow, othersProps = _objectWithoutProperties(props, _excluded2); return /*#__PURE__*/React.createElement(MuiCardHeader, _extends({ classes: classes, className: clsx(classNameProps, shadow && shadowClass), ref: ref }, othersProps)); }); process.env.NODE_ENV !== "production" ? CardHeader.propTypes = { /** * The action to display in the card header. */ action: PropTypes.node, /** * The Avatar for the Card Header. */ avatar: PropTypes.node, /** * @ignore */ className: PropTypes.string, /** * Override or extend the styles applied to the component. * See [CSS API](#css) below for more details. */ classes: PropTypes.object.isRequired, /** * The component used for the root node. * Either a string to use a DOM element or a component. */ component: PropTypes.elementType, /** * If `true`, `subheader` and `title` won't be wrapped by a Typography component. * This can be useful to render an alternative Typography variant by wrapping * the `title` text, and optional `subheader` text * with the Typography component. */ disableTypography: PropTypes.bool, shadow: PropTypes.bool, /** * The content of the component. */ subheader: PropTypes.node, /** * These props will be forwarded to the subheader * (as long as disableTypography is not `true`). */ subheaderTypographyProps: PropTypes.object, /** * The content of the Card Title. */ title: PropTypes.node, /** * These props will be forwarded to the title * (as long as disableTypography is not `true`). */ titleTypographyProps: PropTypes.object } : void 0; export default withStyles(styles, { name: 'KrowdyCardHeader' })(CardHeader);