-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3366cdf
commit f8dd1a6
Showing
6 changed files
with
234 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
import { Link, useLocation } from 'react-router-dom'; | ||
import clsx from 'clsx'; | ||
import { useColorMode } from '@docusaurus/theme-common'; | ||
import SearchBar from '@theme/SearchBar'; | ||
import ColorModeToggle from '@theme/ColorModeToggle'; | ||
import styles from './styles.module.scss'; | ||
import DocsVersionDropdownNavbarItem from '@theme/NavbarItem/DocsVersionDropdownNavbarItem'; | ||
|
||
function SecondNavbarContent() { | ||
const { colorMode, setColorMode } = useColorMode(); | ||
const location = useLocation(); | ||
const isDocsPath = location.pathname.startsWith('/docs'); | ||
if (!isDocsPath) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className={clsx(styles.secondNavbar, colorMode === 'dark' && styles.darkMode)}> | ||
<div className={styles.container}> | ||
<div className={styles.versionDropdown}> | ||
<DocsVersionDropdownNavbarItem | ||
docsPluginId="default" | ||
dropdownItemsBefore={[]} | ||
dropdownItemsAfter={[]} | ||
dropdownActiveClassDisabled={false} | ||
mobile={false} | ||
/> | ||
</div> | ||
<div className={clsx(styles.navbarItemsRight)}> | ||
<div className={styles.colorModeToggle}> | ||
<ColorModeToggle | ||
className="clean-btn toggleButton_node_modules-@docusaurus-theme-classic-lib-theme-ColorModeToggle-styles-module" | ||
title={`Switch between dark and light mode (currently ${colorMode} mode)`} | ||
aria-label={`Switch between dark and light mode (currently ${colorMode} mode)`} | ||
aria-live="polite" | ||
onChange={() => setColorMode(colorMode === 'dark' ? 'light' : 'dark')} | ||
/> | ||
</div> | ||
<div className={styles.searchBox}> | ||
<SearchBar /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
function SecondNavbar() { | ||
return ( | ||
<SecondNavbarContent /> | ||
); | ||
} | ||
|
||
export default SecondNavbar; |
64 changes: 64 additions & 0 deletions
64
docs-website/src/components/SecondNavbar/styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.secondNavbar { | ||
background-color: #fff; | ||
border-bottom: 1px solid #eaeaea; | ||
z-index: 10; | ||
color: black; | ||
|
||
&.darkMode { | ||
background-color: #000; | ||
color: #fff; | ||
} | ||
} | ||
|
||
.container, | ||
.coreCloudSwitch, | ||
.docsSwitchButton { | ||
display: flex; | ||
align-items: center; | ||
height: 50px; | ||
} | ||
|
||
.container { | ||
padding: 0rem 1rem; | ||
} | ||
|
||
.coreCloudSwitch { | ||
width: var(--doc-sidebar-width); | ||
} | ||
|
||
.docsSwitchButton { | ||
padding: 0.5rem 1rem; | ||
font-weight: 500; | ||
font-size: 1.1rem; | ||
color: black; | ||
text-decoration: none; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
text-decoration: none; | ||
color: #007bff; | ||
} | ||
} | ||
|
||
.activeButton { | ||
border-bottom: 2px solid #007bff; | ||
} | ||
|
||
.darkMode .docsSwitchButton { | ||
color: white; | ||
|
||
&:hover { | ||
color: #4db5ff; | ||
} | ||
} | ||
|
||
.searchBox, | ||
.colorModeToggle { | ||
padding: 0.5rem 1rem; | ||
} | ||
|
||
.navbarItemsRight { | ||
display: flex; | ||
margin-left: auto; | ||
align-items: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import Layout from '@theme-original/Layout'; | ||
import SecondNavbar from '../../components/SecondNavbar/SecondNavbar'; | ||
|
||
export default function LayoutWrapper(props) { | ||
return ( | ||
<> | ||
<Layout {...props}> | ||
<SecondNavbar /> | ||
{props.children} | ||
</Layout> | ||
</> | ||
); | ||
} |
Oops, something went wrong.