@aliretail/react-materials-components
Version:
27 lines (22 loc) • 789 B
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["hashName", "children", "href"];
import * as React from 'react';
import classnames from 'classnames';
var Item = function Item(props) {
var hashName = props.hashName,
children = props.children,
href = props.href,
restProps = _objectWithoutPropertiesLoose(props, _excluded);
var active = function () {
if (!hashName || !href) {
return false;
}
return hashName === href;
}();
return /*#__PURE__*/React.createElement("a", _extends({
className: classnames('aliretail-fixed-nav-item', active && 'active'),
href: href
}, restProps), children);
};
export default Item;