UNPKG

@slashid/docusaurus-theme-slashid

Version:
34 lines (32 loc) 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = NavbarItemWrapper; var _react = _interopRequireDefault(require("react")); var _react2 = require("@slashid/react"); var _NavbarItem = _interopRequireDefault(require("@theme-init/NavbarItem")); var _domain = require("../../domain"); var _useSlashIDConfig = require("../hooks/useSlashIDConfig"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* ============================================================================ * Copyright (c) SlashID * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * ========================================================================== */ function isNavItem(item) { return typeof item.to === "string"; } function NavbarItemWrapper(props) { const options = (0, _useSlashIDConfig.useSlashIDConfig)(); const { user } = (0, _react2.useSlashID)(); if (isNavItem(props) && !(0, _domain.shouldPathRender)(props.to, options.privatePaths, user)) { return null; } return <> <_NavbarItem.default {...props} /> </>; }