Skip to content

Commit

Permalink
fix: allow user to control the back-to-top button presence (#1616)
Browse files Browse the repository at this point in the history
* fix: put the btt button closer to age bottom

* test: remove the btt button to check

* test: fallback to default behaviour

* refactor: rollback to previous state

* use proper variable name

* Update src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html

---------

Co-authored-by: Daniel McCloy <dan@mccloy.info>
  • Loading branch information
12rambau and drammock authored Jan 18, 2024
1 parent 80b3e51 commit 5fc1452
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"version_match": version_match,
},
"navigation_with_keys": False,
# "back_to_top_button": False,
# "search_bar_position": "navbar", # TODO: Deprecated - remove in future version
}

Expand Down
2 changes: 1 addition & 1 deletion src/pydata_sphinx_theme/assets/styles/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pre {
z-index: $zindex-tooltip;
position: fixed;
display: none;
top: 80vh;
top: 90vh;
left: 50vw;
transform: translate(-50%);
color: var(--pst-color-secondary-text);
Expand Down
2 changes: 2 additions & 0 deletions src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@
{# A tiny helper pixel to detect if we've scrolled #}
<div id="pst-scroll-pixel-helper"></div>

{%- if theme_back_to_top_button %}
{# the scroll to top button #}
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>
{{ _("Back to top") }}
</button>
{%- endif %}

{# checkbox to toggle primary sidebar #}
<input type="checkbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pygment_light_style = a11y-high-contrast-light
pygment_dark_style = a11y-high-contrast-dark
logo =
surface_warnings = True
back_to_top_button = True

# Template placement in theme layouts
navbar_start = navbar-logo
Expand Down

0 comments on commit 5fc1452

Please sign in to comment.