semantic-ui-react
Version:
The official Semantic-UI-React integration.
49 lines (38 loc) • 1.34 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 statistic can contain a label to help provide context for the presented value.
*/
function StatisticLabel(props) {
var children = props.children,
className = props.className,
label = props.label;
var classes = cx('label', className);
var rest = getUnhandledProps(StatisticLabel, props);
var ElementType = getElementType(StatisticLabel, props);
return React.createElement(
ElementType,
_extends({}, rest, { className: classes }),
_isNil(children) ? label : children
);
}
StatisticLabel.handledProps = ['as', 'children', 'className', 'label'];
StatisticLabel._meta = {
name: 'StatisticLabel',
parent: 'Statistic',
type: META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? StatisticLabel.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. */
label: customPropTypes.contentShorthand
} : void 0;
export default StatisticLabel;