mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-28 03:15:16 +00:00
64 lines
2.0 KiB
JavaScript
64 lines
2.0 KiB
JavaScript
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
||
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import classNames from 'classnames';
|
||
|
import { mapToCssModules, tagPropType } from './utils';
|
||
|
var propTypes = {
|
||
|
tabs: PropTypes.bool,
|
||
|
pills: PropTypes.bool,
|
||
|
vertical: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
||
|
horizontal: PropTypes.string,
|
||
|
justified: PropTypes.bool,
|
||
|
fill: PropTypes.bool,
|
||
|
navbar: PropTypes.bool,
|
||
|
card: PropTypes.bool,
|
||
|
tag: tagPropType,
|
||
|
className: PropTypes.string,
|
||
|
cssModule: PropTypes.object
|
||
|
};
|
||
|
var defaultProps = {
|
||
|
tag: 'ul',
|
||
|
vertical: false
|
||
|
};
|
||
|
|
||
|
var getVerticalClass = function getVerticalClass(vertical) {
|
||
|
if (vertical === false) {
|
||
|
return false;
|
||
|
} else if (vertical === true || vertical === 'xs') {
|
||
|
return 'flex-column';
|
||
|
}
|
||
|
|
||
|
return "flex-" + vertical + "-column";
|
||
|
};
|
||
|
|
||
|
var Nav = function Nav(props) {
|
||
|
var className = props.className,
|
||
|
cssModule = props.cssModule,
|
||
|
tabs = props.tabs,
|
||
|
pills = props.pills,
|
||
|
vertical = props.vertical,
|
||
|
horizontal = props.horizontal,
|
||
|
justified = props.justified,
|
||
|
fill = props.fill,
|
||
|
navbar = props.navbar,
|
||
|
card = props.card,
|
||
|
Tag = props.tag,
|
||
|
attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tabs", "pills", "vertical", "horizontal", "justified", "fill", "navbar", "card", "tag"]);
|
||
|
|
||
|
var classes = mapToCssModules(classNames(className, navbar ? 'navbar-nav' : 'nav', horizontal ? "justify-content-" + horizontal : false, getVerticalClass(vertical), {
|
||
|
'nav-tabs': tabs,
|
||
|
'card-header-tabs': card && tabs,
|
||
|
'nav-pills': pills,
|
||
|
'card-header-pills': card && pills,
|
||
|
'nav-justified': justified,
|
||
|
'nav-fill': fill
|
||
|
}), cssModule);
|
||
|
return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {
|
||
|
className: classes
|
||
|
}));
|
||
|
};
|
||
|
|
||
|
Nav.propTypes = propTypes;
|
||
|
Nav.defaultProps = defaultProps;
|
||
|
export default Nav;
|