Skip to content

Commit 855d234

Browse files
Fix navbar alignment by adding navbar_align configuration to PyData Sphinx Theme (#162)
* Improve navbar alignment Signed-off-by: parth <parth.bhanushali241@sakec.ac.in> * Also updated in {{cookiecutter.package}} Signed-off-by: parth <parth.bhanushali241@sakec.ac.in> * Inculding css file in cookiecutter_Package Signed-off-by: parth <parth.bhanushali241@sakec.ac.in> --------- Signed-off-by: parth <parth.bhanushali241@sakec.ac.in>
1 parent b75225d commit 855d234

4 files changed

Lines changed: 100 additions & 1 deletion

File tree

docs/source/_static/css/custom.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,8 @@ body[data-hide-sidebar="true"] .bd-main {
8686
flex-grow: 1;
8787
max-width: 75%;
8888
}
89+
90+
.bd-header .navbar-header-items__start {
91+
margin-right: 0 !important;
92+
padding-right: 1.5rem;
93+
}

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
html_theme_options = {
7171
"navbar_start": ["navbar-logo"],
72-
"navbar_center": ["navbar-nav"],
72+
"navbar_align": "left",
7373
"icon_links": [
7474
{
7575
"name": "GitHub",
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
html[data-theme=dark] {
2+
--pst-color-primary: #04B46D;
3+
--pst-color-link: var(--pst-color-primary);
4+
}
5+
6+
html[data-theme=light] {
7+
--pst-color-primary: #03A062;
8+
--pst-color-link: var(--pst-color-primary);
9+
}
10+
11+
body .bd-article-container {
12+
max-width: 100em !important;
13+
}
14+
/* Custom CSS for the documentation site */
15+
/* prevent logo from being too wide and text clashing with next item */
16+
/* See https://github.com/pydata/pydata-sphinx-theme/issues/1143#issuecomment-2468763375 */
17+
18+
.navbar-header-items__start .navbar-item {
19+
width: 100%;
20+
}
21+
22+
.navbar-item .navbar-brand {
23+
width: 100%;
24+
}
25+
26+
.navbar-brand img {
27+
min-width: 0;
28+
height: auto;
29+
max-height: 100%;
30+
flex-shrink: 1;
31+
}
32+
33+
.navbar-brand p {
34+
flex: 0 1 auto;
35+
}
36+
37+
/* sponsors */
38+
39+
.col {
40+
flex: 0 0 50%;
41+
max-width: 50%;
42+
}
43+
44+
.img-sponsor {
45+
height: 50px;
46+
padding-top: 5px;
47+
padding-right: 5px;
48+
padding-bottom: 5px;
49+
padding-left: 5px;
50+
}
51+
52+
.things-in-a-row {
53+
display: flex;
54+
flex-wrap: wrap;
55+
justify-content: space-between;
56+
}
57+
58+
/* grids to match theme colors */
59+
.sd-card-icon {
60+
color: var(--sd-color-primary);
61+
font-size: 1.5em;
62+
margin-bottom: 0.5rem;
63+
}
64+
65+
.sd-card {
66+
padding: 1.5rem;
67+
transition: transform 0.2s;
68+
}
69+
70+
.sd-card:hover {
71+
transform: translateY(-5px);
72+
}
73+
74+
/* Ensuring content area uses full width when sidebar is hidden */
75+
.bd-page-width {
76+
max-width: 90% !important;
77+
}
78+
79+
/* Hide sidebar on pages with hide-sidebar metadata */
80+
body[data-hide-sidebar="true"] .bd-sidebar-primary {
81+
display: none !important;
82+
}
83+
84+
/* Expand content width when sidebar hidden */
85+
body[data-hide-sidebar="true"] .bd-main {
86+
flex-grow: 1;
87+
max-width: 75%;
88+
}
89+
90+
.bd-header .navbar-header-items__start {
91+
margin-right: 0 !important;
92+
padding-right: 1.5rem;
93+
}

{{cookiecutter.package_name}}/docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292

9393
# Customize the theme
9494
html_theme_options = {
95+
"navbar_align": "left",
9596
"icon_links": [
9697
{
9798
# Label for this link

0 commit comments

Comments
 (0)