semantic-ui-react
Version:
The official Semantic-UI-React integration.
49 lines (38 loc) • 1.26 kB
JavaScript
import _extends from 'babel-runtime/helpers/extends';
import _isNil from 'lodash/isNil';
import cx from 'classnames';
import React, { PropTypes } from 'react';
import { customPropTypes, getElementType, getUnhandledProps, META } from '../../lib';
/**
* A card can contain a header.
*/
function CardHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = cx(className, 'header');
var rest = getUnhandledProps(CardHeader, props);
var ElementType = getElementType(CardHeader, props);
return React.createElement(
ElementType,
_extends({}, rest, { className: classes }),
_isNil(children) ? content : children
);
}
CardHeader.handledProps = ['as', 'children', 'className', 'content'];
CardHeader._meta = {
name: 'CardHeader',
parent: 'Card',
type: META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CardHeader.propTypes = {
/** An element type to render as (string or function). */
as: customPropTypes.as,
/** Primary content. */
children: PropTypes.node,
/** Additional classes. */
className: PropTypes.string,
/** Shorthand for primary content. */
content: customPropTypes.contentShorthand
} : void 0;
export default CardHeader;