UNPKG

@slashid/docusaurus-theme-slashid

Version:
31 lines (29 loc) 920 B
/* ============================================================================ * 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. * ========================================================================== */ import React from "react"; import { useSlashID } from "@slashid/react"; import NavbarItem from "@theme-init/NavbarItem"; import { shouldPathRender } from "../../domain"; import { useSlashIDConfig } from "../hooks/useSlashIDConfig"; function isNavItem(item) { return typeof item.to === "string"; } export default function NavbarItemWrapper(props) { const options = useSlashIDConfig(); const { user } = useSlashID(); if ( isNavItem(props) && !shouldPathRender(props.to, options.privatePaths, user) ) { return null; } return ( <> <NavbarItem {...props} /> </> ); }