Skip to content
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

Add banner feature to qiskit theme #530

Merged
merged 11 commits into from
Aug 10, 2023
Merged

Conversation

javabster
Copy link
Collaborator

@javabster javabster commented Aug 7, 2023

In this PR:

  • add optional purple gradient banner to all pages
  • add optional "Learn more" link to banner
  • update readme
  • works for mobile view
  • snapshot tests for banner component

I'm struggling to figure out how to add new snapshots for this component, any help appreciated!

Screenshot 2023-08-07 at 5 13 10 PM Screenshot 2023-08-07 at 5 12 02 PM Screenshot 2023-08-07 at 5 19 30 PM

@MaldoAlberto
Copy link
Collaborator

@javabster is only add the images in the snapshot test?

@javabster
Copy link
Collaborator Author

@MaldoAlberto the issue I'm facing is that new screenshots are not being generated for the announcement banner tests 😅 I'm not sure what's going wrong, possibly because the docker setup is not realising that the option has been set in the conf.py? I'm not really sure

@MaldoAlberto
Copy link
Collaborator

@javabster I saw the images from announcement is not created, because not exist a html file to obtain the snapshot, the others I found in example_docs/docs/_build/html

@javabster
Copy link
Collaborator Author

yeah I don't really understand what is happening with these snapshots tbh, when I was doing my dev work locally I was able to build with the announcement banner in the example_docs, but for some reason when I try run the snapshots workflow (I'm trying to follow the instructions in the contributing guide) the banner isn't getting generated for some reason? I'm trying to figure out how the docker image is getting built but I'm a bit lost tbh.

Also no idea why the CI snapshots keep failing when the "actual" images look exactly the same as the originals 😅

@MaldoAlberto
Copy link
Collaborator

I found the path for the announcement is example_docs/docs/_ecosystem_build/index.html but the others are in
example_docs/docs/_build/

and yes the error is weird say the size of the image is different for one pixel
Screenshot 2023-08-08 at 6 17 31 PM

Copy link
Member

@frankharkins frankharkins left a comment

Choose a reason for hiding this comment

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

Looks good! I only have one suggestion but it's non-blocking.

{% block announcement %} {{ theme_announcement }} {% endblock announcement %}
{% if announcement_url -%}
<a href="{{announcement_url}}" class="reference internal">Learn more
Copy link
Member

@frankharkins frankharkins Aug 9, 2023

Choose a reason for hiding this comment

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

Can you allow setting the link text in the conf.py? Usually it's better to have the link text describe the page the user is going to.

@MaldoAlberto
Copy link
Collaborator

MaldoAlberto commented Aug 9, 2023

Looks good! I only have one suggestion but it's non-blocking.

If I'm not mistaken, this needs to add the announce snapshots

@MaldoAlberto MaldoAlberto reopened this Aug 9, 2023
@javabster
Copy link
Collaborator Author

I adjusted the padding of the banner and made it so that users can configure the text used for the link (it defaults to "Learn more" unless specified in conf.py)
Screenshot 2023-08-09 at 2 37 49 PM
Screenshot 2023-08-09 at 2 37 59 PM

Copy link
Member

@frankharkins frankharkins left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @javabster!

I've left another comment and the snapshot tests would be nice, but if time is a concern I think it's fine to merge now and make an issue to address later.


// custom announcement banner with purple gradient
.custom-announcement {
top: var(--qiskit-top-nav-bar-height);
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 this line is unneeded, but it shouldn't break anything so this comment is non-blocking.

Screenshot 2023-08-10 at 13 47 49

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah good spot! I'll remove it

@javabster
Copy link
Collaborator Author

Issue created to add snapshot tests: #533

@javabster javabster merged commit a570ada into Qiskit:main Aug 10, 2023
4 checks passed
@atalle
Copy link

atalle commented Aug 10, 2023

@javabster I'm sorry I'm just seeing your comment in slack about padding! Can we increase top/bottom padding from 14px to 16px?

Eric-Arellano added a commit that referenced this pull request Dec 4, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants