UNPKG

@carbon/ibm-security

Version:

Carbon for Cloud & Cognitive IBM Security UI components

50 lines (49 loc) 1.88 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["className", "status", "title", "titleTooltipDirection", "truncate"]; /** * @file Summary card header. * @copyright IBM Security 2019 */ import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import StringFormatter from '../../StringFormatter'; import { getComponentNamespace } from '../../../globals/namespace/index'; export var namespace = getComponentNamespace('summary-card__header'); var SummaryCardHeader = function SummaryCardHeader(_ref) { var className = _ref.className, status = _ref.status, title = _ref.title, titleTooltipDirection = _ref.titleTooltipDirection, truncate = _ref.truncate, other = _objectWithoutProperties(_ref, _excluded); return /*#__PURE__*/React.createElement("div", _extends({ className: classnames(namespace, className) }, other), /*#__PURE__*/React.createElement("h2", { className: "".concat(namespace, "__title") }, /*#__PURE__*/React.createElement(StringFormatter, { truncate: truncate, value: title, tooltipDirection: titleTooltipDirection })), status); }; SummaryCardHeader.propTypes = { /** Extra class names to add. */ className: PropTypes.string, /** The status of the Card. */ status: PropTypes.node, /** The title of the summary card. */ title: PropTypes.string.isRequired, /** Specify the direction of the title's tooltip. Can be either top or bottom. */ titleTooltipDirection: PropTypes.oneOf(['top', 'bottom']), /** Whether or not the value should be truncated. */ truncate: PropTypes.bool }; SummaryCardHeader.defaultProps = { className: null, status: undefined, titleTooltipDirection: 'bottom', truncate: false }; export default SummaryCardHeader;