Skip to content

Commit

Permalink
Feat: Add default announcement (#161)
Browse files Browse the repository at this point in the history
* Add announcent default

* Add announcent input

* Add js to dynamic insert of contents

* Remove text

* Rename announcement files

* Rename announcement file

* Revert changes

* Read txt file

* Add styles

* Add path to the announcement

* Add error for testing

* DBG: check file present

* Add announcement message layout

* Revert the file name

* resolves the layout

* remove background from announcemnet default

* Add new style for announcement

* Add version warning color

* Add version warning color to light red

* Add opacity for the dark theme

* correcting the layout of css.

Co-authored-by: Jorge Martinez Garrido <[email protected]>
  • Loading branch information
Revathyvenugopal162 and jorgepiloto authored Dec 2, 2022
1 parent 1a3e4ed commit 1bf7038
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/
.Python
_build/
build/
_build/
develop-eggs/
dist/
downloads/
Expand Down
14 changes: 14 additions & 0 deletions src/ansys_sphinx_theme/announcement_layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% if theme_switcher %}
<div id="announcement_msg"></div>
<script>
fetch("announcement.html")
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error: ${response.status}`);
}
return response.text();
})
.then(text => document.getElementById("announcement_msg").innerHTML = text)
.catch((error) => console.error(`Fetch problem: ${error.message}`));
</script>
{% endif %}
1 change: 1 addition & 0 deletions src/ansys_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

{% block docs_navbar %}
{{ super() }}
{% include 'announcement_layout.html' %}
{% if theme_show_breadcrumbs %}
{% include 'breadcrumbs.html' %}
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions src/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ html[data-theme="dark"] {
--pst-color-on-surface: rgb(55, 55, 55);
--pst-color-info: var(--pst-color-secondary);


/*****************************************************************************
* extensions
*/
Expand Down
40 changes: 40 additions & 0 deletions src/ansys_sphinx_theme/static/css/breadcrumbs.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,44 @@ body {

*, :after, :before {
box-sizing: border-box;
}

#announcement_msg {
display: flex;
justify-content: center;
position: relative;
width: 100%;
padding: 0.5rem 12.5%;
text-align: center;
}

#announcement_msg :after {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color:rgb(223, 95, 114);
opacity: 0.2;
content: "";
z-index: -1;
}

#announcement_msg :empty {
display: none;
}

#announcement_msg p {
font-weight: bold;
margin: auto;
color:black;
}

html[data-theme="dark"] #announcement_msg :after{
background-color:lightpink;
opacity: 0.5;
}

#announcement_msg a {
color:#1E6DDC
}

0 comments on commit 1bf7038

Please sign in to comment.