Skip to content

Update pydata theme to 0.10 #597

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

Merged
merged 75 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
8ab4c61
update pyproject dependencies, link to prev-next, using announcement …
AakashGfude Jul 26, 2022
fec749a
updating layout.html, header-article, and using sidebar-primary and s…
AakashGfude Jul 26, 2022
9e9ca0b
header-article styles and sidebar-secondary style and html
AakashGfude Jul 26, 2022
d617024
scroll-pixel-helper, js fix, removing sidebar secondary css
AakashGfude Jul 26, 2022
e8aef57
setting sidebar primary styles
AakashGfude Jul 27, 2022
3fdc6ea
styling changes and rtd footer
AakashGfude Jul 28, 2022
f483810
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 28, 2022
7cab01f
changing comment and class name in _readthedocs
AakashGfude Jul 28, 2022
9b4a7f1
adding layout html, scss for sidebars and article width
AakashGfude Jul 30, 2022
e26498d
sidebar secondary styles
AakashGfude Jul 31, 2022
910e808
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Jul 31, 2022
f04e20f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 31, 2022
7400de8
sidebar secondary styles, margin, sidebars
AakashGfude Aug 1, 2022
8bead42
Merge branch 'master' into updt-pydata-0.10
AakashGfude Aug 1, 2022
4b25376
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 1, 2022
84dadff
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 1, 2022
6394af5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 1, 2022
df06dbe
removing package-lock.json here, but we should keep it in the repo in…
AakashGfude Aug 1, 2022
c7c7be8
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 1, 2022
5ad3a12
transition css
AakashGfude Aug 2, 2022
97cbe13
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 4, 2022
cbac680
sidebar secondary toc
AakashGfude Aug 4, 2022
8906812
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 4, 2022
8342f63
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 4, 2022
ef5c9e1
updated pydata version
AakashGfude Aug 15, 2022
b00c966
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 15, 2022
7c093aa
cleaning layout file and empyting block navbar
AakashGfude Aug 17, 2022
9031b2b
correcting header-article and sidebar-secondary styles, html
AakashGfude Aug 17, 2022
1f56581
max width 50em
AakashGfude Aug 18, 2022
82a7467
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 18, 2022
6c60479
footer content style
AakashGfude Aug 18, 2022
4c4a092
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 18, 2022
7d446cc
removing footer and editing primary sidebar
AakashGfude Aug 19, 2022
9f1a7a6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 19, 2022
7933831
added some styles
AakashGfude Aug 22, 2022
e38e18e
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 22, 2022
d55232c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 22, 2022
1185d8f
search bar style
AakashGfude Aug 23, 2022
fda71f2
Merge branch 'master' into updt-pydata-0.10
AakashGfude Aug 23, 2022
b7abf67
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 23, 2022
e88c122
css and style changes
AakashGfude Aug 28, 2022
bae766d
some admontion scss
AakashGfude Aug 28, 2022
0592a1c
added some admonition classed and generate_toctree_html
AakashGfude Aug 28, 2022
6b2a1d1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 28, 2022
cad8a51
container widths
AakashGfude Aug 28, 2022
0ef5512
admonition styling
AakashGfude Aug 29, 2022
adade87
added nprint js and css/html changes
AakashGfude Aug 29, 2022
2493713
css and js adjustments
AakashGfude Aug 29, 2022
fff2b7f
tests correction
AakashGfude Aug 29, 2022
16553ee
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 29, 2022
bb90d7b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 29, 2022
34d850f
updating to pydata 10.1
AakashGfude Aug 30, 2022
cb84124
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Aug 30, 2022
4674e96
styles for toggle button
AakashGfude Sep 1, 2022
492062b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 1, 2022
95ab90e
changing test to accomodate primary sidebar
AakashGfude Sep 1, 2022
089cef7
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Sep 1, 2022
32216bd
adding variables and comments
AakashGfude Sep 3, 2022
cda1e3d
search related css
AakashGfude Sep 3, 2022
3e56239
secondary sidebar icon and border-left
AakashGfude Sep 8, 2022
562f122
removed admonitions
AakashGfude Sep 21, 2022
80a2694
updating styles in scss
AakashGfude Sep 26, 2022
eb30e64
merging files
AakashGfude Sep 26, 2022
bf32d10
updating links
AakashGfude Sep 27, 2022
341f5d6
changing color codes to rgb
AakashGfude Sep 27, 2022
107ca0e
set default_mode to light
AakashGfude Oct 17, 2022
45c9967
adjusting content width to cater to full-width elements
AakashGfude Oct 18, 2022
e60d56d
config value
AakashGfude Oct 18, 2022
393c13d
default_mode in builder-inited
AakashGfude Oct 19, 2022
abfc613
setting mode to light
AakashGfude Oct 19, 2022
2409962
Merge branch 'master' into updt-pydata-0.10
AakashGfude Oct 19, 2022
71100c0
style edits for small anomalies
AakashGfude Oct 20, 2022
eb58dcf
Merge branch 'master' into updt-pydata-0.10
AakashGfude Oct 20, 2022
5962068
Merge branch 'updt-pydata-0.10' of https://github.com/executablebooks…
AakashGfude Oct 20, 2022
e4f52ba
search input placeholder color
AakashGfude Oct 25, 2022
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ readme = "README.md"

requires-python = ">=3.7"
dependencies = [
"sphinx>=3,<5",
"pydata-sphinx-theme~=0.8.0",
"sphinx>=3,<6",
"pydata-sphinx-theme~=0.10.0rc1",
Copy link
Member

Choose a reason for hiding this comment

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

I'd try rc2 - that makes some more changes

"pyyaml",
]

Expand Down
6 changes: 3 additions & 3 deletions src/sphinx_book_theme/assets/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var toggleFullScreen = () => {
* the screen.
*/
var scrollToActive = () => {
var navbar = document.getElementById("site-navigation");
var navbar = document.getElementsByClassName("bd-sidebar-primary")[0];
Copy link
Member

Choose a reason for hiding this comment

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

I think that we should be able to delete the whole scrolltoactive section, since that code exists in the pydata theme:

https://github.com/pydata/pydata-sphinx-theme/blob/cf8a947c695211600d928bbb39bcd74b6f11ce8a/src/pydata_sphinx_theme/assets/scripts/index.js#L155

Copy link
Member Author

Choose a reason for hiding this comment

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

how is it supposed to work again? the primary sidebar should scroll automatically if the active page is off-screen right?

Copy link
Member Author

Choose a reason for hiding this comment

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

@choldgraf I checked using master, and this doesn't seem to be working #609 . Did it work for you?

var active_pages = navbar.querySelectorAll(".active");
var active_page = active_pages[active_pages.length - 1];
// Only scroll the navbar if the active link is lower than 50% of the page
Expand Down Expand Up @@ -116,9 +116,9 @@ var initTocHide = () => {

// Hide the TOC if any margin content is displayed on the screen
if (onScreenItems.length > 0) {
$("div.bd-toc").removeClass("show");
$("div.bd-sidebar-secondary").removeClass("show");
} else {
$("div.bd-toc").addClass("show");
$("div.bd-sidebar-secondary").addClass("show");
}
};
let manageScrolledClassOnBody = (entries, observer) => {
Expand Down
2 changes: 1 addition & 1 deletion src/sphinx_book_theme/assets/styles/content/_code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ div[class*="highlight-"] {

// Code blocks should have a margin, but code *cells* get margin from a parent
div.highlight {
background: none;
background: none !important;
margin-bottom: 1em;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* ReadTheDocs pop-up menu over-rides.
* We nest everything under `.bd-sidebar` so that we use more selective
* We nest everything under `.bd-sidebar-primary` so that we use more selective
* selectors than what RTD CSS uses.
*/
.bd-sidebar {
.bd-sidebar-primary {
// Parent container for everything else
div#rtd-footer-container {
position: sticky;
Expand Down
23 changes: 9 additions & 14 deletions src/sphinx_book_theme/assets/styles/sections/_article.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
* Main content layout *
*********************************************/

body {
padding-top: 0px !important;
}

#main-content,
#print-main-content {
transition: padding $animation-time ease-out;
padding-top: 1.5em;
}

// On wide screens, make space for the right margin
@media (min-width: $breakpoint-md) {
#main-content {
max-width: $content-max-width;
.bd-content {
overflow: unset; // needed for postion:sticky header-article
padding: 0rem;
.bd-article {
padding-right: 2rem;
@media (max-width: $breakpoint-md) {
padding-left: 1rem;
padding-right: 1rem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
* Top Bar *
* TODO: Rename much of these to article-header to conform with sphinx-basic-ng
*********************************************/
.header-article {
.bd-header-article {
height: $header-article-height; // Fix the height so the TOC doesn't grow it
background-color: white;
transition: left 0.2s;
font-size: var(--sbt-header-article-font-size);
position: sticky;
top: 0;
z-index: 1020;

@include header-height-mobile;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/*********************************************
* Left Nav Bar *
*********************************************/
#site-navigation {
.bd-sidebar-primary {
padding-top: 0;
width: $leftbar-width-wide;
padding: 0em;
flex-basis: $leftbar-width-wide;
font-size: var(--sbt-sidebar-font-size);
top: 0px !important;
max-height: 100vh;
background: white;
border-right: $border-thin;
transition: margin-left $animation-time ease 0s,
Expand Down Expand Up @@ -33,13 +35,13 @@
}

// Apply some basic padding so the dropdown buttons don't overlap w/ scrollbar
.bd-sidebar__top,
.bd-sidebar__bottom {
.sidebar-start-items,
.sidebar-end-items {
padding: 0 1rem 0rem 1.5rem;
}

// This should always snap to the bottom even if there's no sidebar content
.bd-sidebar__bottom {
.sidebar-end-items {
margin-top: auto;
margin-bottom: 2em;
}
Expand Down
113 changes: 59 additions & 54 deletions src/sphinx_book_theme/assets/styles/sections/_sidebar-secondary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,65 @@
* Table of Contents (right nav bar) *
*********************************************/

.bd-toc {
.bd-sidebar-secondary {
padding: 0px !important;
right: -1em;
height: auto;
transition: margin-right $animation-time ease 0s,
opacity $animation-time ease 0s, visibility $animation-time ease 0s;
position: static; // toc-item will be made sticky so that z-index works well
max-height: unset;
overflow-y: unset;
transition: margin-right 0.25s ease 0s, opacity 0.25s ease 0s,
visibility 0.25s ease 0s;

.tocsection {
padding: 0.5rem 1rem !important;
.scrolled & {
box-shadow: 0 6px 6px -6px rgba(0, 0, 0, 0.3);
}

&:after {
content: "\f107";
font-family: "Font Awesome 5 Free";
font-weight: 900;
padding-left: 0.5em;
transition: opacity 0.3s ease;
}
}

// Show / hide the in-page TOC items
@mixin show-inpage-toc {
nav {
max-height: 90vh;
opacity: 1;
overflow-y: auto;
}

// Hide the arrow when we display the toc
.tocsection:after {
opacity: 0;
}
}

.toc-item {
padding: 0rem;
position: sticky;
z-index: 3;
top: 0;
height: auto;
background: white;
// On wide screens, show the TOC with hover or w/ a show class
&:hover {
@include show-inpage-toc;
}
}

&.show {
@include show-inpage-toc;
}

.toc-h2 {
font-size: 0.85rem;
}
// Colors
div.onthispage,
.toc-entry a {
Expand Down Expand Up @@ -37,70 +89,23 @@

// By default the nav is hidden unless a few conditions are met
nav {
opacity: 0;
opacity: 1;
max-height: 0;
transition: opacity 0.2s ease, max-height 0.7s ease;
overflow-y: hidden;
background: white;
transition: opacity 0.4s ease, max-height 0.7s ease;
@include scrollbar-style();
@include scrollbar-on-hover();

// TOC link color
a:hover,
li.active > a.active {
color: rgba(var(--pst-color-link), 1);
}

li.active > a.active {
border-left: 2px solid rgba(var(--pst-color-link), 1);
}

> .nav {
border-left: 1px solid #eee;
.nav {
border-left: none;
}
}
}

// Show / hide the in-page TOC items
@mixin show-inpage-toc {
nav {
max-height: 90vh;
opacity: 1;
overflow-y: auto;
}

// Hide the arrow when we display the toc
.tocsection:after {
opacity: 0;
}
}
// On wide screens, show the TOC with hover or w/ a show class
&:hover,
&.show {
@include show-inpage-toc;
}

// On narrow screens, it should always be shown because it's off to the right
@media (max-width: $breakpoint-md) {
@include show-inpage-toc;
}

.tocsection {
padding: 0.5rem 0 0.5rem 1rem !important;

&:after {
content: "\f107";
font-family: "Font Awesome 5 Free";
font-weight: 900;
padding-left: 0.5em;
transition: opacity 0.3s ease;
}
}

.toc-entry a {
.toc-entry a.nav-link {
padding: 0.125rem 1rem !important;
margin-left: 0rem;
}

// Make sure the pydata sphinx theme edit button doesn't show up
Expand Down
102 changes: 19 additions & 83 deletions src/sphinx_book_theme/theme/sphinx_book_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,102 +3,38 @@

{% set is_single_page = (theme_single_page == True) or (theme_single_page == "True") %}


{% block content %}
<!-- Checkboxes to toggle the left sidebar -->
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation" aria-label="Toggle navigation sidebar">
<label class="overlay overlay-navbar" for="__navigation">
<div class="visually-hidden">Toggle navigation sidebar</div>
</label>
<!-- Checkboxes to toggle the in-page toc -->
<input type="checkbox" class="sidebar-toggle" name="__page-toc" id="__page-toc" aria-label="Toggle in-page Table of Contents">
<label class="overlay overlay-pagetoc" for="__page-toc">
<div class="visually-hidden">Toggle in-page Table of Contents</div>
</label>
<!-- Headers at the top -->
<div class="announcement header-item noprint">
{%- include "sections/announcement.html" -%}
</div>
<div class="header header-item noprint">
{%- include "sections/header.html" -%}
</div>
{{ super() }}
{% endblock %}

<!-- Docs TOC is "d-none d-xl-block col-xl-2" -->
{% block docs_sidebar %}
<!-- Sidebar -->
<div class="bd-sidebar noprint{% if is_single_page %} single-page{% endif %}" id="site-navigation">
{%- if not is_single_page %}
<div class="bd-sidebar__content">
<div class="bd-sidebar__top">
{%- include "sections/sidebar.html" -%}
</div>
<div class="bd-sidebar__bottom">
{% if theme_navbar_footer_text %}{% set theme_extra_navbar=theme_navbar_footer_text %}{% endif %} <!-- To handle the deprecated key -->
{% if theme_extra_navbar %}
<div class="navbar_extra_footer">
{{ theme_extra_navbar }}
</div>
{% endif %}
</div>
</div>
<div id="rtd-footer-container"></div>
{%- endif %}
</div>
{% endblock %}

{% block docs_main %}
<!-- A tiny helper pixel to detect if we've scrolled -->
<div class="sbt-scroll-pixel-helper"></div>
<!-- Main content -->
<div class="col py-0 content-container">
{% block docs_body %}
<div class="header-article row sticky-top noprint">
<div class="bd-content col">
<div class="bd-header-article">
{% include "sections/header-article.html" %}
</div>
<div class="article row">
<div class="col pl-md-3 pl-lg-5 content-container">
<!-- Table of contents that is only displayed when printing the page -->
<div id="jb-print-docs-body" class="onlyprint">
<h1>{{ pagetitle }}</h1>
<!-- Table of contents -->
<div id="print-main-content">
<div id="jb-print-toc">
{% set page_toc = generate_toc_html() %}
{%- if page_toc | length >= 1 %}
<div>
<h2> {{ translate(theme_toc_title) }} </h2>
</div>
<nav aria-label="Page">
{{ page_toc }}
</nav>
{%- endif %}
</div>
</div>
</div>
<main id="main-content" role="main">
{{ super() }}
</main>
<footer class="footer-article noprint">
{% include "sections/footer-article.html" %}
</footer>
</div>
</div>
<div class="footer-content row">
<footer class="col footer">

{% block docs_body %}
<article class="bd-article" role="main">
{% block body %} {% endblock %}
</article>
{% endblock %}

{% if theme_show_prev_next %}
<footer class="bd-footer-article">
{% include "sections/footer-article.html" %}
</footer>
{% endif %}
<div class="footer-content">
<footer class="col bd-footer">
{%- include "sections/footer-content.html" %}
</footer>
</div>
{% endblock %}
</div>
{% endblock %}

{%- block footer %}
{%- endblock %}

{% block docs_toc %}
{% endblock %}

{% block docs_navbar %}
{%- endblock %}

{%- block footer %}
{%- endblock %}

This file was deleted.

Loading