Skip to content

Commit 549cb58

Browse files
Enhanced the UI of the Navbar
1 parent e99e37f commit 549cb58

3 files changed

Lines changed: 53 additions & 19 deletions

File tree

docusaurus.config.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dotenv.config({ path: ".env.local" });
77
dotenv.config();
88

99
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
10-
1110
const algoliaAppId = process.env.ALGOLIA_APP_ID?.trim();
1211
const algoliaSearchApiKey = process.env.ALGOLIA_SEARCH_API_KEY?.trim();
1312
const algoliaIndexName = process.env.ALGOLIA_INDEX_NAME?.trim();
@@ -109,12 +108,12 @@ const config: Config = {
109108
title: "recode hive",
110109
logo: {
111110
alt: "recode hive Logo",
112-
src: "img/logo.png",
111+
src: "/img/logo.png",
113112
},
114113
items: [
115114
{
116115
type: "dropdown",
117-
html: '<span class="nav-emoji">📚</span> Docs',
116+
html: '<span class="nav-symbol" aria-hidden="true">🗀</span> Docs',
118117
position: "left",
119118
to: "/docs/",
120119
items: [
@@ -165,66 +164,66 @@ const config: Config = {
165164
},
166165
{
167166
to: "/showcase",
168-
html: '<span class="nav-emoji">🌍</span> Showcase',
167+
html: '<span class="nav-symbol" aria-hidden="true">◇</span> Showcase',
169168
position: "left",
170169
},
171170
{
172171
to: "/dashboard",
173-
html: '<span class="nav-emoji">📊</span> Dashboard',
172+
html: '<span class="nav-symbol" aria-hidden="true">⊞</span> Dashboard',
174173
position: "left",
175174
},
176175
{
177176
to: "/our-sponsors/",
178-
html: '<span class="nav-emoji">💰</span> Donate',
177+
html: '<span class="nav-symbol" aria-hidden="true">$</span> Donate',
179178
position: "left",
180179
},
181180
{
182181
type: "dropdown",
183-
html: '<span class="nav-emoji">👩🏻‍💻</span> Devfolio',
182+
html: '<span class="nav-symbol" aria-hidden="true">⌘</span> Devfolio',
184183
position: "left",
185184
items: [
186185
{
187-
label: "💻GitHub Profiles",
186+
label: "GitHub Profiles",
188187
to: "https://dev.recodehive.com/devfolio",
189188
},
190189
{
191-
label: "🎖️ GitHub Badges",
190+
label: " GitHub Badges",
192191
to: "/badges/github-badges/",
193192
},
194193
],
195194
},
196195
{
197196
to: "/blogs",
198-
html: '<span class="nav-emoji">📰</span> Blogs',
197+
html: '<span class="nav-symbol" aria-hidden="true">✦</span> Blogs',
199198
position: "left",
200199
},
201200
{
202201
type: "dropdown",
203-
html: '<span class="nav-emoji">🔗</span> More',
202+
html: '<span class="nav-symbol" aria-hidden="true">⋯</span> More',
204203
position: "left",
205204
items: [
206205
{
207-
label: "📚 E-books",
206+
label: " E-books",
208207
to: "/ebooks",
209208
},
210209
{
211-
label: "🗺️ Roadmap",
210+
label: " Roadmap",
212211
to: "/roadmaps",
213212
},
214213
{
215-
label: "🤝 Community",
214+
label: " Community",
216215
to: "/community",
217216
},
218217
{
219-
label: "📺 Broadcast",
218+
label: " Broadcast",
220219
to: "/broadcasts/",
221220
},
222221
{
223-
label: "🎙️ Podcast",
222+
label: " Podcast",
224223
to: "/podcasts/",
225224
},
226225
{
227-
label: "🛍️ Merch Store",
226+
label: " Merch Store",
228227
to: "/merch",
229228
},
230229
],

src/css/custom.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,17 @@ body {
617617
0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
618618
}
619619

620+
/* Dark-mode-only navbar logo treatment so the brand mark stays visible on black navbars. */
621+
[data-theme="dark"] .navbar__logo {
622+
background-color: rgba(255, 255, 255, 0.08);
623+
border-radius: 9999px;
624+
box-shadow:
625+
0 0 0 1px rgba(255, 255, 255, 0.14),
626+
0 8px 18px rgba(0, 0, 0, 0.35);
627+
padding: 0.18rem;
628+
filter: brightness(1.08) contrast(1.05);
629+
}
630+
620631
/* ===== SECTION 10: DESKTOP NAVBAR ENHANCEMENTS ===== */
621632
@media (min-width: 1300px) {
622633

@@ -811,6 +822,14 @@ body {
811822
border-radius: 50%;
812823
}
813824

825+
.nav-symbol {
826+
display: inline-block;
827+
margin-right: 0.35rem;
828+
font-size: 0.95em;
829+
line-height: 1;
830+
font-weight: 700;
831+
}
832+
814833
/* Ensure monochrome icons (GitHub, Next.js) are visible in dark mode */
815834
[data-theme="dark"] .dropdown-content .nav__icons img[alt="GitHub"],
816835
[data-theme="dark"] .dropdown-content .nav__icons img[alt="Nextjs"],

src/theme/Navbar/Content/index.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import React, { type ReactNode, useMemo } from "react";
2+
import Link from "@docusaurus/Link";
3+
import useBaseUrl from "@docusaurus/useBaseUrl";
4+
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
25
import { useThemeConfig, ErrorCauseBoundary } from "@docusaurus/theme-common";
36
import { splitNavbarItems } from "@docusaurus/theme-common/internal";
47
import NavbarItem, { type Props as NavbarItemConfig } from "@theme/NavbarItem";
58
import NavbarColorModeToggle from "@theme/Navbar/ColorModeToggle";
69
import AlgoliaSiteSearch from "@site/src/components/AlgoliaSiteSearch";
710
// import SearchBar from '@theme/SearchBar';
811
import NavbarMobileSidebarToggle from "@theme/Navbar/MobileSidebar/Toggle";
9-
import NavbarLogo from "@theme/Navbar/Logo";
1012
// import NavbarSearch from '@theme/Navbar/Search';
1113

1214
// Safe wrapper component that handles the mobile sidebar toggle
@@ -75,6 +77,20 @@ function NavbarContentLayout({
7577
);
7678
}
7779

80+
function NavbarBrand(): ReactNode {
81+
const { siteConfig } = useDocusaurusContext();
82+
const logoConfig = siteConfig.themeConfig.navbar.logo;
83+
const logoSrc = useBaseUrl(logoConfig?.src ?? "img/logo.png");
84+
const logoAlt = logoConfig?.alt ?? siteConfig.title;
85+
86+
return (
87+
<Link className="navbar__brand" to={useBaseUrl("/")} aria-label={siteConfig.title}>
88+
<img className="navbar__logo" src={logoSrc} alt={logoAlt} />
89+
<strong className="navbar__title">{siteConfig.title}</strong>
90+
</Link>
91+
);
92+
}
93+
7894
export default function NavbarContent(): ReactNode {
7995
const items = useNavbarItems();
8096

@@ -90,7 +106,7 @@ export default function NavbarContent(): ReactNode {
90106
<>
91107
{/* Safe wrapper for mobile sidebar toggle */}
92108
<SafeMobileSidebarToggle />
93-
<NavbarLogo />
109+
<NavbarBrand />
94110
<NavbarItems items={leftItems} />
95111
</>
96112
}

0 commit comments

Comments
 (0)