Skip to content

Commit 6e4c1f7

Browse files
authored
Merge pull request #1896 from SahilChachane-27/main
update in navbar
2 parents 2d6e663 + 8b16c9f commit 6e4c1f7

2 files changed

Lines changed: 145 additions & 10 deletions

File tree

src/components/AlgoliaSiteSearch/index.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ export default function AlgoliaSiteSearch(): React.ReactElement | null {
9393
const isConfigured = Boolean(applicationId && apiKey && indexName);
9494

9595
useEffect(() => {
96+
ensureSiteSearchStylesheet();
97+
9698
if (!isConfigured) {
9799
return;
98100
}
99101

100102
let cancelled = false;
101103

102-
ensureSiteSearchStylesheet();
103104
loadSiteSearchScript()
104105
.then(() => {
105106
if (cancelled || !window.SiteSearch?.init) {
@@ -139,7 +140,36 @@ export default function AlgoliaSiteSearch(): React.ReactElement | null {
139140
}, [apiKey, applicationId, indexName, isConfigured]);
140141

141142
if (!isConfigured) {
142-
return null;
143+
return (
144+
<div className="navbar__item algolia-sitesearch-navbar">
145+
<button
146+
className="sitesearch-button"
147+
style={{ opacity: 0.6, cursor: "not-allowed" }}
148+
title="Search (Algolia SiteSearch credentials not configured)"
149+
>
150+
<span className="search-icon">
151+
<svg
152+
width="18"
153+
height="18"
154+
viewBox="0 0 24 24"
155+
fill="none"
156+
stroke="currentColor"
157+
strokeWidth="2"
158+
strokeLinecap="round"
159+
strokeLinejoin="round"
160+
>
161+
<circle cx="11" cy="11" r="8"></circle>
162+
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
163+
</svg>
164+
</span>
165+
<span className="button-text">Search...</span>
166+
<span className="keyboard-shortcut">
167+
<span>Ctrl</span>
168+
<span>K</span>
169+
</span>
170+
</button>
171+
</div>
172+
);
143173
}
144174

145175
return (

src/css/custom.css

Lines changed: 113 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ html[data-theme="dark"] article blockquote {
443443
margin: 0;
444444
height: 60px;
445445
display: flex;
446+
width: 100%;
446447
}
447448

448449
.navbar__brand {
@@ -501,6 +502,7 @@ html[data-theme="dark"] article blockquote {
501502
gap: 0.3rem !important;
502503
margin: 0 !important;
503504
padding: 0 !important;
505+
min-width: 0;
504506
}
505507

506508
.mb-10.text-center>p.mx-auto.max-w-3xl {
@@ -527,12 +529,14 @@ html[data-theme="dark"] article blockquote {
527529
padding: 0.3rem 0.5rem;
528530
font-size: 0.85rem;
529531
line-height: 1.2;
532+
white-space: nowrap;
530533
}
531534

532535
.navbar__link {
533536
display: flex;
534537
align-items: center;
535538
gap: 0.5rem;
539+
white-space: nowrap;
536540
}
537541

538542
/* Fix icon alignment in navbar */
@@ -746,14 +750,20 @@ body {
746750
}
747751

748752
/* ===== SECTION 11: CRITICAL FIX: TABLET/IPAD NAVBAR BEHAVIOR ===== */
749-
@media screen and (max-width: 996px) {
753+
@media screen and (max-width: 1200px) {
750754
/* Hide TOP navbar items on mobile (not sidebar) */
751755

752756
/*
753-
* Hide all navbar items on small screens except the toggle, brand,
754-
* and the Clerk auth control.
757+
* Hide top-level navbar items before they collide. Docusaurus' default
758+
* mobile breakpoint is 996px, but this navbar has enough links to overflow
759+
* on tablets and smaller laptops.
755760
*/
756-
.navbar__items .navbar__item:not(.navbar__toggle):not(.navbar__brand):not( :has(#firebase-auth-github-navbar)) {
761+
.navbar__inner>.navbar__items>.navbar__item:not(.navbar__toggle):not(:has(#clerk-auth-navbar)) {
762+
display: none !important;
763+
}
764+
765+
.navbar__items--right>.navbar__item:not(:has(#clerk-auth-navbar)),
766+
.navbar__items--right .colorModeToggle {
757767
display: none !important;
758768
}
759769

@@ -778,11 +788,13 @@ body {
778788
max-width: 100% !important;
779789
padding: 0 !important;
780790
width: 100% !important;
791+
gap: 0.5rem !important;
781792
}
782793

783794
/* Logo and brand adjustments */
784795
.navbar__brand {
785-
margin-right: 1.5rem !important;
796+
min-width: 0 !important;
797+
margin-right: auto !important;
786798
}
787799

788800
.navbar__logo {
@@ -791,11 +803,16 @@ body {
791803

792804
.navbar__title {
793805
font-size: 1rem !important;
806+
overflow: hidden !important;
807+
text-overflow: ellipsis !important;
794808
}
795809

796810
/* Ensure sidebar toggle is always visible */
797811
.navbar__toggle {
798-
display: block !important;
812+
display: inline-flex !important;
813+
align-items: center !important;
814+
justify-content: center !important;
815+
flex: 0 0 auto !important;
799816
margin-right: 0.5rem !important;
800817
}
801818

@@ -2773,6 +2790,93 @@ html[data-theme="dark"] .blog-post-page article header h2[itemprop="headline"] {
27732790
END SECTION 15
27742791
===================================================== */
27752792

2793+
/* ===== RESPONSIVE NAVBAR OVERFLOW FIX ===== */
2794+
@media screen and (min-width: 1401px) {
2795+
.navbar__inner {
2796+
gap: 0.5rem !important;
2797+
}
2798+
2799+
.navbar__items:not(.navbar__items--right) {
2800+
flex: 1 1 auto !important;
2801+
min-width: 0 !important;
2802+
}
2803+
2804+
.navbar__items--right {
2805+
flex: 0 0 auto !important;
2806+
}
2807+
2808+
.navbar__items>.navbar__item {
2809+
flex: 0 0 auto !important;
2810+
}
2811+
}
2812+
2813+
@media screen and (max-width: 1400px) {
2814+
.navbar,
2815+
.navbar .navbar__inner {
2816+
width: 100% !important;
2817+
max-width: 100% !important;
2818+
overflow: visible !important;
2819+
}
2820+
2821+
.navbar .navbar__inner {
2822+
display: flex !important;
2823+
align-items: center !important;
2824+
justify-content: flex-start !important;
2825+
gap: 0.5rem !important;
2826+
}
2827+
2828+
.navbar .navbar__items {
2829+
min-width: 0 !important;
2830+
}
2831+
2832+
.navbar .navbar__items:not(.navbar__items--right) {
2833+
flex: 1 1 auto !important;
2834+
overflow: hidden !important;
2835+
}
2836+
2837+
.navbar .navbar__items--right {
2838+
flex: 0 0 auto !important;
2839+
margin-left: auto !important;
2840+
}
2841+
2842+
.navbar .navbar__toggle {
2843+
display: inline-flex !important;
2844+
align-items: center !important;
2845+
justify-content: center !important;
2846+
flex: 0 0 40px !important;
2847+
width: 40px !important;
2848+
height: 40px !important;
2849+
}
2850+
2851+
.navbar .navbar__brand {
2852+
flex: 1 1 auto !important;
2853+
min-width: 0 !important;
2854+
max-width: 100% !important;
2855+
margin-right: 0 !important;
2856+
overflow: hidden !important;
2857+
}
2858+
2859+
.navbar .navbar__title {
2860+
min-width: 0 !important;
2861+
overflow: hidden !important;
2862+
text-overflow: ellipsis !important;
2863+
white-space: nowrap !important;
2864+
}
2865+
2866+
.navbar__inner>.navbar__items>.navbar__item:not(.navbar__toggle),
2867+
.navbar__items--right>.navbar__item,
2868+
.navbar__items--right .colorModeToggle {
2869+
display: none !important;
2870+
}
2871+
2872+
.navbar-sidebar .navbar__item,
2873+
.navbar-sidebar .navbar__link,
2874+
.navbar-sidebar .dropdown {
2875+
display: block !important;
2876+
white-space: normal !important;
2877+
}
2878+
}
2879+
27762880
/* ===== MOBILE TOP-GAP FIX ===== */
27772881
@media screen and (max-width: 996px) {
27782882

@@ -2950,9 +3054,10 @@ main[class*='docMainContainer_'] {
29503054
.theme-doc-sidebar-container,
29513055
.menu--responsive,
29523056
div[class*='sidebarViewport_'] {
2953-
z-index: 9999 !important;
3057+
z-index: 9999 !important;
29543058
}
29553059

3060+
29563061
/* Leaderboard Pagination Button Icon Visibility Fix */
29573062
.pagination-btn {
29583063
display: flex !important;
@@ -2987,4 +3092,4 @@ div[class*='sidebarViewport_'] {
29873092
.pagination-btn.disabled {
29883093
opacity: 0.4 !important;
29893094
cursor: not-allowed !important;
2990-
}
3095+
}

0 commit comments

Comments
 (0)