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 "collapse/expand" functionality #2078

Merged
merged 30 commits into from
Apr 16, 2023
Merged

Conversation

Hetarth02
Copy link
Contributor

Recording.2023-03-18.163946.mp4

Hetarth02 and others added 22 commits January 29, 2023 23:07
- Added .vscode to .gitignore
- Changed placeholder to indicate the shortcut use
- Added the change in `CHANGELOG.md`
- Made the suggested edits in `.gitignore`
- Changed placeholder to indicate the shortcut use
- Added the change in `CHANGELOG.md`
- Made the suggested edits in `.gitignore`
Merge branch 'JuliaDocs:master' into development
- Adding padding to menu's element on-hover
- Adding collapse/expand funcitonality to individual article blocks
- Adding collapse/expand all functionality
- Complied scss into css
@Hetarth02
Copy link
Contributor Author

@mortenpi I tried creating another branch as per the discussion in #2065 but it still displays all of the commit history. So, once again to clarify for anyone looking at this PR please check the Files changed menu.

@mortenpi
Copy link
Member

mortenpi commented Mar 23, 2023

I really like this! It makes these long docstring lists readable. And the open/close animation feels pretty smooth.

A couple of thoughts though. What do you think about the following:

  • Having the collapse/expand all button be the rightmost item in the top bar?
  • Could we try a variant where the docstring collapse/expand button is also on the top-right of the docstring?
  • I am wondering if we should have them be collapsed by default?
  • We should do a demo build of the Julia manual with this.

@inkydragon
Copy link
Contributor

https://www.mathworks.com/help/matlab/ref/sin.html
image

  1. Having the collapse/expand all button be the rightmost item in the top bar?

Agree.
Would it be clearer to use text + icons? Just like Matlab doc ①.

  1. Could we try a variant where the docstring collapse/expand button is also on the top-right of the docstring?

For document strings, we can modify the collapsed style, the cursor style when the mouse is selected (③), and also add hint text to highlight that this is a collapsed area that can be clicked to interact with.

  1. I am wondering if we should have them be collapsed by default?

Maybe collapse by default for automatically generated doc str.
We can also add a keyword argument to control the default collapse behavior.

  1. We should do a demo build of the Julia manual with this.

I would say that even though I've done it many times, building julia's documentation is still a bit complicated. Maybe try building the documentation for Documenter.jl first.

@Hetarth02
Copy link
Contributor Author

Hetarth02 commented Mar 29, 2023

@mortenpi

I really like this! It makes these long docstring lists readable. And the open/close animation feels pretty smooth.

Thanks!

  • Having the collapse/expand all button be the rightmost item in the top bar?

The thing is when in responsive mode the side-menu button will be the last.

  • Could we try a variant where the docstring collapse/expand button is also on the top-right of the docstring?

I think we can do that, but the problem then would be when a large name comes it will mess up the design.

  • I am wondering if we should have them be collapsed by default?

Personally I would want them to be expanded, but I am fine with either.

  • We should do a demo build of the Julia manual with this.

I tried but had some issues in generating one. I removed some parts from the julia library to mitigate the errors and was successfully able to build a partial working site. The video I have attached above is the same site I built locally.

@Hetarth02
Copy link
Contributor Author

Hetarth02 commented Mar 29, 2023

@inkydragon

Would it be clearer to use text + icons? Just like Matlab doc ①.

The thing is we don't have much space in the navbar or the docstring title on smaller devices. It is much likely to break the UI on smaller devices when we have text + icons combination.

We can also add a keyword argument to control the default collapse behavior.

Yeah, this is a good idea.

@mortenpi
Copy link
Member

mortenpi commented Mar 29, 2023

The thing is when in responsive mode the side-menu button will be the last.

That just hopped on the other side though, so it's not a problem anymore 🙂 #2076

I tried but had some issues in generating one. I removed some parts from the julia library to mitigate the errors and was successfully able to build a partial working site. The video I have attached above is the same site I built locally.

I didn't realize that it was already showing the Julia manual 🤦 I'm happy to look into doing the full build though. The errors might be due to some changes we've had on master here.

Personally I would want them to be expanded, but I am fine with either.

Let's leave them expanded for now then. Adding a per-block option is a good idea. We could also have a per-page option via an at-meta block. But let's do those in a follow-up PR -- let's not make this PR too complicated.

The thing is we don't have much space in the navbar or the docstring title on smaller devices. It is much likely to break the UI on smaller devices when we have text + icons combination.

I tend agree with this. I think we're kinda forced to go with icons right now.

I think we can do that, but the problem then would be when a large name comes it will mess up the design.

That is fair. I feel that maybe we should follow Matlab's lead here though and have the collapsed icon be > and expanded v.

For document strings, we can modify the collapsed style, the cursor style when the mouse is selected (③), and also add hint text to highlight that this is a collapsed area that can be clicked to interact with.

Yeah, some hover and cursor stuff might be worth trying out.

@Hetarth02 Hetarth02 closed this Mar 29, 2023
@Hetarth02 Hetarth02 reopened this Mar 29, 2023
@Hetarth02
Copy link
Contributor Author

It auto-closed the PR when I synced my fork. I have reopened the PR. Sorry for this!

Hetarth02 and others added 2 commits April 9, 2023 14:18
- Added `>` as a indication instead of `^` for articles
- Changes in `collpase.js`
- Changed cursor to pointer when hovering over articles
@Hetarth02
Copy link
Contributor Author

  • Cursor will be a pointer when hovering over article header.
  • Shifted the Nav-bar toggle to last position
  • Changed the > as a indication instead of ^ for articles(kept the Nav-bar icons as it is)

@Hetarth02
Copy link
Contributor Author

Hetarth02 commented Apr 9, 2023

I'm happy to look into doing the full build though. The errors might be due to some changes we've had on master here.

@mortenpi If possible can you do this and check if everything works fine or are there any changes needed?

Copy link
Member

@mortenpi mortenpi left a comment

Choose a reason for hiding this comment

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

Awesome, this is great! Sorry for the delay, but I think this is nearly good to go if you're done with it.

  • Just some minor suggestions in other comments.
  • Could you add a CHANGELOG entry for this?

In principle, the JS code seems to have some duplication (e.g. the expand/collapse strings), so it could probably be refactored a bit to make it a bit cleaner. But that's pretty minor and not very important here, so more than happy to merge as is.

assets/html/js/collapse.js Outdated Show resolved Hide resolved
assets/html/js/collapse.js Outdated Show resolved Hide resolved
assets/html/js/collapse.js Outdated Show resolved Hide resolved
assets/html/js/collapse.js Outdated Show resolved Hide resolved
@mortenpi
Copy link
Member

Here's a full Julia manual build: http://mortenpi.eu/juliadocs-demos/pr-2078-julia-manual-demo/

image

CHANGELOG.md Outdated Show resolved Hide resolved
@mortenpi mortenpi added Type: Enhancement Format: HTML Related to the default HTML output labels Apr 16, 2023
@mortenpi mortenpi merged commit 7853d05 into JuliaDocs:master Apr 16, 2023
@mortenpi
Copy link
Member

mortenpi commented Apr 16, 2023

Thanks a lot for iterating on this @Hetarth02!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: HTML Related to the default HTML output Type: Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "collapse/expand all" functionality
4 participants