Skip to content

Commit

Permalink
Remove custom announcements feature from Qiskit theme (#580)
Browse files Browse the repository at this point in the history
The Qiskit theme is being removed and we'll only have qiskit-ecosystem,
per #577.

The qiskit-ecosystem theme never supported these custom announcements
from #530 - so this
current code adds unnecessary noise.

If we decide we do want this custom announcement feature for the
Ecosystem, we can always add this code back easily thanks to Git. In the
meantime, the focus is on making this codebase as small and sustainable
as possible.
  • Loading branch information
Eric-Arellano authored Dec 4, 2023
1 parent 11eb12c commit 5b34a1b
Show file tree
Hide file tree
Showing 27 changed files with 2 additions and 125 deletions.
38 changes: 0 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,44 +116,6 @@ The `qiskit_sphinx_theme` extension defines the below custom directives for you
![](tests/js/qiskit.test.js-snapshots/custom-directives-1-linux.png)
![](tests/js/qiskit.test.js-snapshots/custom-directives-2-linux.png)

## Add an announcement banner to all pages

> :warning: **Note:** This feature is currently only available for the Qiskit theme, it is not yet available in the Ecosystem theme

The `qiskit` theme includes the ability to add a custom announcement banner to every page. You can configure this in your `conf.py` by adding your
custom announcement text to the `theme_announcement` variable in the `html_context` object, for example:

```
html_context = {
"theme_announcement": "🎉 Custom announcement text!",
}
```
The above code will enable the following banner:

<img width="1330" alt="Screenshot 2023-08-07 at 5 13 10 PM" src="https://github.com/qiskit-community/ecosystem/assets/23662430/cbb86903-17fd-4752-a955-5e8c5eda3383">

You can also optionally add a "Learn more" url by additionally setting the `announcement_url` in the `html_context`, like so:

```
html_context = {
"theme_announcement": "🎉 Custom announcement text!",
"announcement_url": "https://example.com"
}
```
The above code will render the following banner:

<img width="1327" alt="Screenshot 2023-08-07 at 5 12 02 PM" src="https://github.com/qiskit-community/ecosystem/assets/23662430/79ccb19d-3392-4ea9-993e-b006dc7481dc">

The default text for the link is "Learn more" but you can provide custom link text by setting the `announcement_url_text` in the `html_context`:
```
html_context = {
"theme_announcement": "🎉 Custom announcement text!",
"announcement_url": "https://example.com",
"announcement_url_text": "Check it out",
}
```

## Customize or disable the Ecosystem theme logo

The `qiskit-ecosystem` theme includes the Qiskit Ecosystem logo by default.
Expand Down
4 changes: 0 additions & 4 deletions example_docs/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@
# Users of the theme can set prior version numbers. They'll
# show up in the sidebar under the "Previous Versions" section.
"version_list": [0.1, 0.2, 0.3],
# Users of the theme can set the text and optional url for an announcement banner
"theme_announcement": "🎉 Custom announcement text!",
"announcement_url_text": "Check it out",
"announcement_url": "https://google.com",
}

docs_url_prefix = "ecosystem/example_docs"
Expand Down
47 changes: 0 additions & 47 deletions src/qiskit_sphinx_theme/assets/styles/_announcement.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

@import "admonitions";
@import "announcement";
@import "api";
@import "colors";
@import "custom-directives";
Expand Down
14 changes: 2 additions & 12 deletions src/qiskit_sphinx_theme/theme/qiskit-sphinx-theme/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,9 @@
</label>

{% if theme_announcement -%}
<div class="custom-announcement">
<aside class="custom-announcement-content">
<div class="announcement">
<aside class="announcement-content">
{% block announcement %} {{ theme_announcement }} {% endblock announcement %}
{% if announcement_url -%}
<a href="{{announcement_url}}" class="reference internal">
{% if announcement_url_text -%}
{{announcement_url_text}}
{% else %}
Learn more
{%- endif %}
<svg class="icon"><use href="#svg-new-tab"></use></svg>
</a>
{%- endif %}
</aside>
</div>
{%- endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@
<rect id="_x3C_Transparent_Rectangle_x3E_" fill="none" width="32" height="32"/>
</svg>
</symbol>
<symbol id="svg-new-tab" viewBox="0 0 32 32">
<svg id="icon" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<defs>
<style>
.cls-1 {
fill: none;
}
</style>
</defs>
<path fill="#6929C4" d="M26,28H6a2.0027,2.0027,0,0,1-2-2V6A2.0027,2.0027,0,0,1,6,4H16V6H6V26H26V16h2V26A2.0027,2.0027,0,0,1,26,28Z"/>
<polygon fill="#6929C4" points="20 2 20 4 26.586 4 18 12.586 19.414 14 28 5.414 28 12 30 12 30 2 20 2"/>
<rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-1" width="32" height="32"/>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24">
<title>Light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions tests/js/qiskit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,3 @@ test("inline table of contents have correct fonts", async ({ page }) => {
const contents = page.locator("section#example-docs");
await expect(contents).toHaveScreenshot();
});

test("custom announcement banner", async ({ page }) => {
await page.goto("");
const banner = page.locator(".custom-announcement");
await expect(banner).toHaveScreenshot();

await setMobile(page);
await expect(banner).toHaveScreenshot();
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/js/qiskit.test.js-snapshots/api-docs-module-page-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file modified tests/js/qiskit.test.js-snapshots/custom-directives-2-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/js/qiskit.test.js-snapshots/custom-directives-3-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/js/qiskit.test.js-snapshots/custom-directives-4-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5b34a1b

Please sign in to comment.