UNPKG

@krowdy-ui/core

Version:

React components that implement Google's Material Design.

100 lines (90 loc) 2.71 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; // 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 const styles = theme => ({ action: {}, avatar: {}, content: {}, root: {}, shadow: { borderBottom: `1px solid ${theme.palette.grey[300]}`, boxShadow: theme.shadows[1], padding: theme.spacing(1.25, 2) }, subheader: {}, title: {} }); const CardHeader = React.forwardRef(function CardHeader(props, ref) { const { className: classNameProps, classes: { shadow: shadowClass }, shadow = false } = props, classes = _objectWithoutPropertiesLoose(props.classes, ["shadow"]), othersProps = _objectWithoutPropertiesLoose(props, ["className", "classes", "shadow"]); 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);