Skip to content

DOC [PST] landing page #28331

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

Merged
merged 24 commits into from
Feb 22, 2024

Conversation

Charlie-XIAO
Copy link
Contributor

@Charlie-XIAO Charlie-XIAO commented Feb 1, 2024

Please note that this PR targets the new_web_theme branch!

Towards #28084. This main task of this PR is to retain the iconic look of the scikit-learn landing page, while adapting to the dark theme at our best effort.

Copy link

github-actions bot commented Feb 1, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 725acb9. Link to the linter CI: here

@Charlie-XIAO
Copy link
Contributor Author

Charlie-XIAO commented Feb 1, 2024

Why generating index.rst?

The development link is a variable depending on whether the version is a dev release. Originally we keep the variable in the context and use in the template, but I'm not sure if we can use it in an rst. So generating index.rst is my workaround. If maintainers know better ways to do this I'm happy to change.

Why not register as a callback but call directly in conf.py?

First they don't rely on app, and don't rely on anything generated by sphinx, hence it is just unnecessary to register them as callbacks. Also when working on #28279 I noticed that the dependencies between callbacks and extensions can be much more complex than I thought, though this does not happen for this particular PR.

Outdated

Why the JS?

This is to achieve the following layout. I'm not sure if there is a better way to do so (I think this is very hard to achieve with pure CSS because things are in different cards)... and after all this is just personal taste so if not desired, please let me know so I can simplify/remove. One additional consideration is how things work if JS is disabled. I think with the current implementation things would just not align anymore with JS disabled; nothing else would be broken.

image

The topbar color has changed?

Yes because I tried to play with the colors generated in colors.scss (variations of the logo colors) to simulate the current top bar instead of directly using the old colors. Emm they look not completely the same. The cyan part does not differ a lot, but the orange part is now "redder" than before. May need further tuning if the current colors are not satisfactory.

Briefly summarize the changes in index.html?

  • To make the bottom funding logos look a bit better, added a small padding with a white background.
  • Adapt to the pydata-sphinx-theme layout.
  • Adaptions to the new version of bootstrap that pydata-sphinx-theme is using and to the new style sheet.
  • Attributes like sk-align-group and sk-align-name are used by index.js.
  • Some of the links seem outdated or involve #... that is unnecessary (from my own perspective). Maintainers can try to click around to check if the new ones seem reasonable.
  • Some formatting for clarity.

@Charlie-XIAO Charlie-XIAO marked this pull request as ready for review February 1, 2024 02:03
Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

No opinion on the js part, but I like the rendered version, neat. And the JS is quite short.

@Charlie-XIAO Charlie-XIAO changed the title DOC switch to pydata-sphinx-theme [2>1] landing page DOC [PST] landing page Feb 7, 2024
@Charlie-XIAO
Copy link
Contributor Author

Charlie-XIAO commented Feb 9, 2024

@glemaitre: Do you have time for a review? 😁
@thomasjpfan: This is the fix for the landing page which was separated from the work in #28132. Perhaps you want to take a look.

@betatim
Copy link
Member

betatim commented Feb 9, 2024

I'm not a great fan of using JS to do the alignment. The main reason being that the content renders unaligned, I start looking at it and then a second or so later it gets moved. I admit it is a pet peeve born out of trying to interact with a UI element just in the moment it moves (mostly on my phone). Which often results in me clicking something else, having to go back, etc, etc

I had a look through the boostrap (v5) documentation to see if they offer a solution or advice/opinion on this topic but couldn't find anything.

Currently on scikit-learn.org/ there is no alignment.

So overall I'd vote for not doing alignment with JS.

@Charlie-XIAO
Copy link
Contributor Author

Charlie-XIAO commented Feb 9, 2024

I'm not a great fan of using JS to do the alignment. The main reason being that the content renders unaligned, I start looking at it and then a second or so later it gets moved. I admit it is a pet peeve born out of trying to interact with a UI element just in the moment it moves (mostly on my phone). Which often results in me clicking something else, having to go back, etc, etc

Thanks for the catch @betatim, I didn't really notice this problem. I've just solved a similar issue in pydata-sphinx-theme where contents bump up due to the JS delay; really shouldn't have made essentially a same mistake here. Given such abrupt movements I also prefer removing the alignment.

@betatim
Copy link
Member

betatim commented Feb 14, 2024

This looks ready to merge to me or is there something else that needs doing?

@Charlie-XIAO
Copy link
Contributor Author

There's nothing else to do on my side. Do we need more maintainers to approve?

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

A few comments and a question:

is it intentional that the top level navbar is now fixed when scrolling on the landing page?

It used to be the case that this would only happen on non-home pages prior to this PR.

I have no strong opinion either way. At least now the behavior is more consistent across pages. I am not sure if the special casing of the home page navbar was intentional or not. Maybe @thomasjpfan knows?

@Charlie-XIAO
Copy link
Contributor Author

Charlie-XIAO commented Feb 16, 2024

is it intentional that the top level navbar is now fixed when scrolling on the landing page?

I believe in the current theme the behavior is intentional: there is nav.html which sets the class of the navbar based on pagename thus the difference. But here I'm using {{ super() }} so maybe it is harder to do so...

@thomasjpfan
Copy link
Member

casing of the home page navbar was intentional or not. Maybe @thomasjpfan knows?

It was intentional, but I am okay with this PR which makes it consistent.

@ogrisel
Copy link
Member

ogrisel commented Feb 22, 2024

I believe in the current theme the behavior is intentional: there is nav.html which sets the class of the navbar based on pagename thus the difference. But here I'm using {{ super() }} so maybe it is harder to do so...

Alright, I am fine with the consistently fixed behavior of the navbar on all pages including the landing page. Is there some old navbar related HTML/CSS to clean-up as a result? The sk-docs-navbar CSS class is of no use anymore, right? Or maybe those CSS rules we already cleaned-up in a previous PR?

Similarly, the nav.html could probably be simplified if we do no longer need custom classes for the landing page and the other pages.

@Charlie-XIAO
Copy link
Contributor Author

Charlie-XIAO commented Feb 22, 2024

Everything under the original themes folder is unused now. I didn't remove them only to be able to search things more easily. Theoretically the whole folder can be deleted at any time.

The new CSS (under the scss folder) should contain no redundant code because I took only relevant parts in the first place instead of copy-paste then remove.

@betatim
Copy link
Member

betatim commented Feb 22, 2024

Time to merge then? Cleaning up the old theme folder could be a new PR?

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

Minor suggestion that would also apply for other .scss files but otherwise, LGTM.

@ogrisel
Copy link
Member

ogrisel commented Feb 22, 2024

Note: while building this branch with make html-noplot in the docs folder, I got the following warnings:

copying binder notebooks...[100%] auto_examples
Sphinx-Gallery gallery_conf["plot_gallery"] was False, so no examples were executed.
embedding documentation hyperlinks...
embedding documentation hyperlinks for auto_examples... [100%] plot_lof_outlier_detection.html
Preparing carousel images
Removing methods from search index
WARNING: Failed to tweak gallery links in /Users/ogrisel/code/scikit-learn/doc/_build/html/stable/auto_examples/bicluster/plot_spectral_coclustering.html: 'NoneType' object has no attribute 'a'
WARNING: Failed to tweak gallery links in /Users/ogrisel/code/scikit-learn/doc/_build/html/stable/auto_examples/bicluster/plot_spectral_biclustering.html: 'NoneType' object has no attribute 'a'
WARNING: Failed to tweak gallery links in /Users/ogrisel/code/scikit-learn/doc/_build/html/stable/auto_examples/bicluster/plot_bicluster_newsgroups.html: 'NoneType' object has no attribute 'a'
WARNING: Failed to tweak gallery links in /Users/ogrisel/code/scikit-learn/doc/_build/html/stable/auto_examples/classification/plot_digits_classification.html: 'NoneType' object has no attribute 'a'
...

This is probably unrelated to this PR as the sphinxext/move_gallery_links.py script was introduced in another PR but I think it we should make that script robust to html-noplot builds.

@Charlie-XIAO
Copy link
Contributor Author

Thanks for spotting that. I will look into it and fix with another PR.

@Charlie-XIAO
Copy link
Contributor Author

I added the comment for all current scss files. I think it's good to go now.

@ogrisel ogrisel merged commit 2520ff4 into scikit-learn:new_web_theme Feb 22, 2024
@ogrisel
Copy link
Member

ogrisel commented Feb 22, 2024

Merged! thanks again for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment