Skip to content

Commit

Permalink
Add Knowledge Base link to navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
justindeguzman committed Nov 4, 2024
1 parent 6db063d commit 0d0b69b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/components/DocsCategoryDropdown/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useRef, useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import Link from '@docusaurus/Link'
import styles from './styles.module.css';

function DocsCategoryDropdown({ dropdownCategory }) {
Expand Down Expand Up @@ -69,6 +70,14 @@ function DocsCategoryDropdown({ dropdownCategory }) {
);
}

export const DocsCategoryDropdownLinkOnly = ({ title, link }) => {
return (
<div className={styles.docsNavDropdownContainer}>
<Link href={link} className={styles.docsNavDropdownToolbarLink}>{title}</Link>
</div>
);
}

const DropdownContent = ({ dropdownCategory, handleMouseLeave, dropdownStyles, dropdownMenuRef }) => {
const [hovered, setHovered] = useState(null);
const history = useHistory();
Expand Down
4 changes: 4 additions & 0 deletions src/components/DocsCategoryDropdown/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
margin-right: 30px;
}

.docsNavDropdownToolbarLink:hover {
text-decoration: none;
}

.docsNavDropdownToolbarLink:hover {
color: black;
}
Expand Down
3 changes: 2 additions & 1 deletion src/theme/Navbar/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ScrollableElement from "../../ScrollableElement";
import ColorModeToggle from "../../../components/ColorModeToggler";
import { usePluginData } from "@docusaurus/useGlobalData";
import GlobalMenu from "./GlobalMenu";
import DocsCategoryDropdown from "../../../components/DocsCategoryDropdown";
import DocsCategoryDropdown, { DocsCategoryDropdownLinkOnly } from "../../../components/DocsCategoryDropdown";
import Navigation from "../../../components/Navigation";
function useNavbarItems() {
// TODO temporary casting until ThemeConfig type is improved
Expand Down Expand Up @@ -342,6 +342,7 @@ export default function NavbarContent() {
{dropdownCategories.map((dropdownCategory, index) => {
return <DocsCategoryDropdown key={index} dropdownCategory={dropdownCategory} />
})}
<DocsCategoryDropdownLinkOnly title='Knowledge Base' link='/docs/knowledgebase' />
</div>
<div
className={`${styles.secondaryMenuRight} secondary-nav--items-right`}
Expand Down

0 comments on commit 0d0b69b

Please sign in to comment.