@dabapps/roe
Version:
A collection of React components, styles, mixins, and atomic CSS classes to aid with the development of web applications.
18 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var classNames = require("classnames");
var React = require("react");
/**
* NavItems are used inside of a Nav. These already have basic hover styles applied.
* You should **always** nest an `<a>` inside a NavItem. This is not part of the component so that you can use other
* components in place of an `<a>`, such as a React Router link (which renders an `<a>` also).
* These can have an active class applied to them to highlight the currently active page.
* You may apply `button` and related classes to a NavItem e.g. for a logout button.
* See the [Nav](#nav) section for a full example.
*/
var NavItem = function (props) {
var className = props.className, children = props.children, active = props.active, _a = props.component, Component = _a === void 0 ? 'li' : _a;
return (React.createElement(Component, { className: classNames('nav-item', active && 'active', className) }, children));
};
exports.default = React.memo(NavItem);
//# sourceMappingURL=nav-item.js.map