Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/variable header height #286

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions pydata_sphinx_theme/static/css/theme.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
:root {
/*****************************************************************************
* Theme config
**/
--header-height: 60px;

/*****************************************************************************
* Font size
**/
Expand Down
6 changes: 3 additions & 3 deletions pydata_sphinx_theme/static/webpack-macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

{% macro head_pre_bootstrap() %}
<link href="{{ pathto('_static/css/theme.css', 1) }}" rel="stylesheet" />
<link href="{{ pathto('_static/css/index.9d12c5eb74364d5955370ddd9e2b2e85.css', 1) }}" rel="stylesheet" />
<link href="{{ pathto('_static/css/index.e5250f280ebcea5fe1e84e6e44ee735a.css', 1) }}" rel="stylesheet" />
{% endmacro %}

{% macro head_js_preload() %}
<link rel="preload" as="script" href="{{ pathto('_static/js/index.f77e788ac4de8d0ef24c.js', 1) }}">
<link rel="preload" as="script" href="{{ pathto('_static/js/index.316d110deaf8b9ce2406.js', 1) }}">
{% endmacro %}

{% macro body_post() %}
<script src="{{ pathto('_static/js/index.f77e788ac4de8d0ef24c.js', 1) }}"></script>
<script src="{{ pathto('_static/js/index.316d110deaf8b9ce2406.js', 1) }}"></script>
{% endmacro %}
7 changes: 4 additions & 3 deletions src/scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ html {
}

body {
padding-top: 75px;
padding-top: calc(var(--header-height) + 20px);

background-color: white;
font-family: var(--font-family-base);
Expand Down Expand Up @@ -112,10 +112,11 @@ pre {
// offsetting html elements with anchor attached to adjust for fixed header
:target {
&::before {
// offsetting html anchor titles to adjust for fixed header
display: block;
content: '';
height: 60px;
margin: -60px 0 0;
height: var(--header-height);
margin: calc(-1 * var(--header-height)) 0 0;
background-color: white;
}
}
11 changes: 10 additions & 1 deletion src/scss/_navbar.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
.navbar {
position: fixed;
height: var(--header-height);
width: 100%;
padding: 0;
overflow: hidden;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's caused by this hidden overflow. @hoetmaaiers do you remember why this was added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't directly remember why this was added. But the mobile dropdown is blamed by it? Is an other issue already registered for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see #304 for the issue, and #313 for a potential fix.

Also other dropdowns in the navbar (in non-mobile mode) are not working because of this.


.container-xl {
height: 100%;
}
}

.navbar-brand {
position: relative;
height: 45px;
height: 100%;
width: auto;
padding: 0.5rem 0;

img {
max-width: 100%;
Expand Down
12 changes: 6 additions & 6 deletions src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ div.deprecated {
margin-bottom: 10px;
margin-top: 10px;
padding: 7px;
background-color: #F3E5E5;
background-color: #f3e5e5;
border: 1px solid #eed3d7;
border-radius: .5rem;
border-radius: 0.5rem;

p {
color:#b94a48;
color: #b94a48;
display: inline;
}
}
Expand Down Expand Up @@ -158,7 +158,7 @@ table.field-list {
@supports (position: -webkit-sticky) or (position: sticky) {
position: -webkit-sticky;
position: sticky;
top: 5rem;
top: calc(var(--header-height) + 20px);
height: calc(100vh - 5rem);
overflow-y: auto;
}
Expand Down Expand Up @@ -199,13 +199,14 @@ table.field-list {

.bd-sidebar {
padding-top: 1em;

@include media-breakpoint-up(md) {
border-right: 1px solid rgba(0, 0, 0, 0.1);

@supports (position: -webkit-sticky) or (position: sticky) {
position: -webkit-sticky;
position: sticky;
top: 76px;
top: calc(var(--header-height) + 20px);
z-index: 1000;
height: calc(100vh - 4rem);
}
Expand Down Expand Up @@ -374,7 +375,6 @@ table.field-list {
}
}


> .active > ul {
display: block;
}
Expand Down