Skip to content

Commit 41566db

Browse files
authored
feat(docs): enable navbar (#18324)
## Which issue does this PR close? - Closes #18284. ## What changes are included in this PR? I've enabled the navbar, which is required to use dark-light mode toggle and made following changes in the ui - Removed the existing logo in the side-bar (as it was redundant) - Removed search bar in the side-bar (as it was conflicting with navbar's search widget) <img width="1280" height="939" alt="image" src="https://github.com/user-attachments/assets/52bebca7-34a6-4a3b-bb30-8aa2ca6e2c8f" /><br> <img width="1280" height="939" alt="image" src="https://github.com/user-attachments/assets/69ce9922-ef78-4b2c-bf6e-36860d170635" />
1 parent f57da83 commit 41566db

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

docs/source/_static/theme_overrides.css

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
--pst-color-h2: var(--color-text-base);
3030
/* Use softer blue from bootstrap's default info color */
3131
--pst-color-info: 23, 162, 184;
32-
--pst-header-height: 0px;
3332
}
3433

3534
code {
@@ -40,16 +39,34 @@ code {
4039
text-align: center;
4140
}
4241

42+
/* Limit both light and dark mode logos in the navbar */
43+
.logo__image {
44+
height: 32px;
45+
width: auto;
46+
max-height: 2.5rem;
47+
}
48+
4349
/* Display appropriate logo for dark and light mode */
44-
.light-logo { display: inline; }
45-
.dark-logo { display: none; }
46-
47-
@media (prefers-color-scheme: dark) {
48-
.light-logo { display: none; }
49-
.dark-logo {
50-
display: inline;
51-
background-color: transparent !important;
52-
}
50+
.light-logo {
51+
display: inline;
52+
}
53+
54+
.dark-logo {
55+
display: none;
56+
}
57+
58+
html[data-theme="dark"] .light-logo {
59+
display: none;
60+
}
61+
62+
html[data-theme="dark"] .dark-logo {
63+
display: inline;
64+
background-color: transparent !important;
65+
}
66+
67+
/* Align search bar & theme switch right */
68+
.navbar-header-items__end {
69+
margin-left: auto;
5370
}
5471

5572
/* Ensure the logo is properly displayed */

docs/source/_templates/docs-sidebar.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
<p>
2-
<a href="{{ pathto(master_doc) }}">
3-
<img src="{{ pathto('_static/images/original.svg', 1) }}" class="logo light-logo" alt="logo">
4-
<img src="{{ pathto('_static/images/original_dark.svg', 1) }}" class="logo dark-logo" alt="logo">
5-
</a>
6-
</p>
7-
<p>
8-
<form class="bd-search d-flex align-items-center" action="{{ pathto('search') }}" method="get">
9-
<input type="search" class="form-control" name="q" id="search-input" placeholder="{{ theme_search_bar_text }}" aria-label="{{ theme_search_bar_text }}" autocomplete="off" >
10-
</form>
11-
</p>
121
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
132

143
<div class="bd-toc-item active">

docs/source/_templates/layout.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{% extends "pydata_sphinx_theme/layout.html" %}
22

3-
{# Silence the navbar #}
4-
{% block docs_navbar %}
5-
{% endblock %}
6-
73
<!--
84
Custom footer
95
-->

docs/source/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@
8888
html_theme = "pydata_sphinx_theme"
8989

9090
html_theme_options = {
91+
"logo": {
92+
"image_light": "_static/images/original.svg",
93+
"image_dark": "_static/images/original_dark.svg",
94+
},
9195
"use_edit_page_button": True,
96+
"navbar_center": [],
97+
"navbar_end": ["theme-switcher"],
9298
}
9399

94100
html_context = {

0 commit comments

Comments
 (0)