UNPKG

gsy-component-library

Version:
69 lines (52 loc) 2.34 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _bind = require('classnames/bind'); var _bind2 = _interopRequireDefault(_bind); var _Diamond = require('../Diamond/Diamond'); var _Diamond2 = _interopRequireDefault(_Diamond); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var IndicatorItem = function IndicatorItem(props) { var callback = props.callback, className = props.className, title = props.title, state = props.state, inactive = props.inactive, iconUrl = props.iconUrl, other = _objectWithoutProperties(props, ['callback', 'className', 'title', 'state', 'inactive', 'iconUrl']); var itemClasses = (0, _bind2.default)('progressIndicator__item', 'progressIndicator__item--' + state, { 'progressIndicator__item--disabled': inactive }, className); return _react2.default.createElement( 'a', { onClick: callback, className: itemClasses }, _react2.default.createElement(_Diamond2.default, { kind: 'small', type: 'indicator', iconUrl: iconUrl }), _react2.default.createElement( 'span', _extends({}, other, { className: 'progressIndicator__title' }), title ) ); }; IndicatorItem.propTypes = { state: _propTypes2.default.oneOf(['current', 'next', 'prev']), title: _propTypes2.default.string.isRequired, callback: _propTypes2.default.func.isRequired, iconUrl: _propTypes2.default.string.isRequired, inactive: _propTypes2.default.bool, className: _propTypes2.default.string }; IndicatorItem.defaultProps = { className: '', inactive: false }; exports.default = IndicatorItem;