@momentum-ui/react-collaboration
Version:
Cisco Momentum UI Framework for React Collaboration Applications
44 lines • 2.46 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React from 'react';
import classnames from 'classnames';
import FocusRing from '../FocusRing';
import Icon from '../Icon';
import Badge from '../Badge';
import Text from '../Text';
import ButtonSimple from '../ButtonSimple';
import { DEFAULTS, STYLE } from './NavigationTab.constants';
import './NavigationTab.style.scss';
var NavigationTab = function (props) {
var icon = props.icon, label = props.label, _a = props.count, count = _a === void 0 ? DEFAULTS.COUNT : _a, className = props.className, id = props.id, size = props.size, style = props.style, active = props.active, otherProps = __rest(props, ["icon", "label", "count", "className", "id", "size", "style", "active"]);
var iconComponent = icon ? (React.createElement(Icon, { className: STYLE.icon, name: icon, scale: 24, weight: 'filled' })) : null;
var labelComponent = size == 200 && label ? (React.createElement(Text, { className: STYLE.label, type: "subheader-secondary", tagName: "h3" }, label)) : null;
var badgeComponent = count > 0 ? (React.createElement(Badge, { className: STYLE.count, type: "counter", counter: count, maxCounter: 99, overlay: size !== 200 })) : null;
return (React.createElement(FocusRing, null,
React.createElement(ButtonSimple, __assign({ className: classnames(STYLE.wrapper, className), "data-active": active || DEFAULTS.ACTIVE, "data-size": size || DEFAULTS.SIZE, id: id, style: style }, otherProps),
iconComponent,
labelComponent,
badgeComponent)));
};
export default NavigationTab;
//# sourceMappingURL=NavigationTab.js.map