Skip to content

Commit

Permalink
Various post 0.15 fixes (#241)
Browse files Browse the repository at this point in the history
* SunPyify the surface colors to fix rtd popout

* Style search better

* Update src/sunpy_sphinx_theme/theme/sunpy/static/sunpy_style.css

* Fix dropdown offset so it's correct on default zoom

* Add transparent non-hover border to search button

So that it dosen't suddenly grow by 6px

* More RTD Flyout tweaks

* More tweaks

* Test that we can set footer links

* Add back support for upstream external links

* Remove old footer.html we can rely on upstream now
  • Loading branch information
Cadair committed Mar 22, 2024
1 parent 2634f6f commit b746f2d
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 30 deletions.
10 changes: 10 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@
"reproject": ("https://reproject.readthedocs.io/en/stable/", None),
}
html_theme = "sunpy"

html_theme_options = {
"footer_links": [
("Google", "https://google.com", 3),
("DDG", "https://duckduckgo.com", 3),
],
"external_links": [
{"name": "Python", "url": "https://www.python.org/"},
],
}
graphviz_output_format = "svg"
graphviz_dot_args = [
"-Nfontsize=10",
Expand Down
2 changes: 1 addition & 1 deletion src/sunpy_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def update_config(app):
if not theme_options.get("navbar_links"):
theme_options["navbar_links"] = default_navbar()

if theme_options.get("footer_links", False) != []:
if not theme_options.get("footer_links", False):
theme_options["footer_links"] = [
("Code", "https://github.com/sunpy", 3),
("Forum", "https://community.openastronomy.org/c/sunpy", 3),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@
{% endif %}
{%- endfor %}
{% endif %}
{% if theme_external_links %}
{%- for external_link in theme_external_links %}
<li class="nav-item ms-2"><a class="nav-link nav-external" role="button" href="{{ external_link['url'] }}">{{ external_link['name'] }}</a></li>
{%- endfor %}
{% endif %}
</ul>
</nav>
25 changes: 0 additions & 25 deletions src/sunpy_sphinx_theme/theme/sunpy/sections/footer.html

This file was deleted.

53 changes: 49 additions & 4 deletions src/sunpy_sphinx_theme/theme/sunpy/static/sunpy_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

/* Component Colors */
/* If you add or change the names of these please update the docs */
--sst-footer-background-color: var(--sst-dark-color);
--sst-footer-background-color: var(--sst-lightest-color);
--sst-header-background: var(--sst-dark-color);
--sst-header-text: var(--sst-lighter-color);
--sst-sidebar-background-color: var(--pst-color-background);
Expand Down Expand Up @@ -82,7 +82,7 @@ html[data-theme="light"] {
--pst-color-secondary: var(--sst-accent-color-bright);
--pst-color-shadow: rgba(0, 0, 0, 0.1);
--pst-color-success-bg: #d6ece1;
--pst-color-surface: #f3f4f5;
--pst-color-surface: var(--sst-lightest-color);
--pst-color-target: #f3cf95;
--pst-color-text-muted: #48566b;
--pst-color-warning-bg: #f8e3d0;
Expand Down Expand Up @@ -116,7 +116,7 @@ html[data-theme="dark"] {
--pst-color-secondary: var(--sst-accent-color-bright);
--pst-color-shadow: rgba(0, 0, 0, 0.2);
--pst-color-success-bg: #002f17;
--pst-color-surface: #29313d;
--pst-color-surface: var(--sst-darker-color);
--pst-color-target: #675c04;
--pst-color-text-muted: #9ca4af;
--pst-color-warning-bg: #652a02;
Expand Down Expand Up @@ -232,7 +232,7 @@ html[data-theme="light"] .bd-sidebar-primary .theme-switch-button span {
--bs-dropdown-border-radius: 0rem;
background-color: var(--sst-header-background);
box-shadow: none;
margin-top: 0.85rem;
margin-top: 0.86rem;
border: 0;
border-color: var(--sst-accent-color-bright);
}
Expand Down Expand Up @@ -281,12 +281,57 @@ img.logo__image {
color: var(--pst-color-primary);
}

/* Hide the search bar in the flyout */
.rst-other-versions dl:has(form#flyout-search-form) {
display: none;
}

/* Reduce the margin at the end */
.rst-versions .rst-other-versions hr {
margin: 5px 0;
border-top-color: var(--pst-color-border);
}

/* Bizzarely having a minimum height here fixes the permanent appearance of the */
/* sidebar scrollbar */
#rtd-footer-container {
min-height: 1rem;
}

/* Revert the flyout footer to the RTD font size */
.rst-versions small {
font-size: 90%;
}

/* Search Box */
.search-button__wrapper.show input {
border: none;
}
.form-control {
border: none;
}

.form-control:focus,
.form-control:focus-visible {
outline: none;
}

form.bd-search:focus-within {
border: 2px solid var(--pst-color-accent);
}

.search-button-field {
border: 2px solid rgba(0, 0, 0, 0);
}

html[data-theme="light"] .search-button-field:hover {
background-color: var(--sst-light-color);
}

html[data-theme="dark"] .search-button-field:hover {
background-color: var(--sst-darkest-color);
}

/* Footers */

.bd-footer {
Expand Down

0 comments on commit b746f2d

Please sign in to comment.