Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit c219c9c

Browse files
Hubert KosterHubert Koster
authored andcommitted
chore: refactoring code
1 parent 5050a1f commit c219c9c

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

src/styles/index.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ body {
126126
display: none !important;
127127
}
128128

129-
.unofficial-host .hide-sidebar-item {
130-
display: none !important;
129+
.unofficial-host {
130+
.hide-sidebar-item {
131+
display: none !important;
132+
}
133+
.navbar__items--right {
134+
display: none !important;
135+
}
131136
}
132137

133138
.swiper {

src/theme/Navbar/Content/index.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ function useNavbarItems() {
1414
return useThemeConfig().navbar.items;
1515
}
1616
function NavbarItems({ items }) {
17-
const unofficial_domain_items = [];
17+
let unofficial_domain_item;
1818
const { is_official_domain } = useOfficialContentsContext();
1919

2020
for (const value of Object.values(items)) {
21-
if (value.label === 'Documentation' || value.position === 'right') {
22-
unofficial_domain_items.push(value);
21+
console.log(value);
22+
if (value.label === 'Documentation') {
23+
unofficial_domain_item = value;
24+
break;
2325
}
2426
}
2527

@@ -45,21 +47,19 @@ function NavbarItems({ items }) {
4547
</React.Fragment>
4648
) : (
4749
<React.Fragment>
48-
{unofficial_domain_items.map((unofficial_item, i) => (
49-
<ErrorCauseBoundary
50-
key={i}
51-
onError={(error) =>
52-
new Error(
53-
`A theme navbar item failed to render.
54-
Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
55-
${JSON.stringify(unofficial_item, null, 2)}`,
56-
{ cause: error },
57-
)
58-
}
59-
>
60-
<NavbarItem {...unofficial_item} />
61-
</ErrorCauseBoundary>
62-
))}
50+
<ErrorCauseBoundary
51+
key={unofficial_domain_item?.label}
52+
onError={(error) =>
53+
new Error(
54+
`A theme navbar item failed to render.
55+
Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
56+
${JSON.stringify(unofficial_domain_item, null, 2)}`,
57+
{ cause: error },
58+
)
59+
}
60+
>
61+
<NavbarItem {...unofficial_domain_item} />
62+
</ErrorCauseBoundary>
6363
</React.Fragment>
6464
)}
6565
</>

0 commit comments

Comments
 (0)