forked from napari/napari-sphinx-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version warning banner functionality
Adds a a warning banner to be shown on non-stable versions of the docs. Inspired by pydata/pydata-sphinx-theme#780
- Loading branch information
Showing
6 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/napari_sphinx_theme/assets/styles/_header-version-warning.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* A warning banner to direct users to a stable version of the documentation. | ||
*/ | ||
.bd-header-version-warning { | ||
position: relative; // So the background color variable fill works | ||
padding: 1rem; | ||
|
||
.bd-header-version-warning__content { | ||
@include background-from-color-variable(--pst-color-danger, 0.2); | ||
display: flex; | ||
justify-content: center; | ||
align-content: center; | ||
gap: 1rem; | ||
font-size: 1.2rem; | ||
span { | ||
margin: auto 0; | ||
text-align: center; | ||
} | ||
|
||
// The button to the right of the banner text. | ||
a { | ||
z-index: 1; // To put it above the background banner. | ||
|
||
button { | ||
font-size: 1.2rem; | ||
background-color: var(--pst-color-danger); | ||
color: var(--pst-color-on-background); | ||
|
||
&:active { | ||
opacity: 0.8; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/napari_sphinx_theme/theme/napari_sphinx_theme/version-warning.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{# A placeholder for a version warning that will be replaced with a banner #} | ||
{# ref: components/version-switcher.html for JS that does this #} | ||
{%- if theme_switcher %} | ||
<!-- A placeholder we use to insert a version warning banner if a preferred version is specified. --> | ||
<div id="header-version-warning-placeholder"></div> | ||
{% endif -%} |