rdoc icon indicating copy to clipboard operation
rdoc copied to clipboard

Add support for mobile screen sizes on Darkfish

Open MatheusRich opened this issue 2 years ago • 11 comments

This adds support for reading the Darkfish-generated docs in mobile devices. I tried to keep the changes minimal, and the current layout was mostly preserved.

The most notable change is the navigation sidebar, which is now hidden by default on "small screens" (everything below 1024px). It can be toggled by the button on the top left corner. This button implements the ARIA pattern for a disclosure widget. The icon for the button was taken from Iconoir, which is licensed under the MIT license.

The design and some of the implementation were loosely inspired by the Elixir lang docs.

Screenshots

General look (before/after)

image image

Code blocks (before/after)

image image

Desktop view (before/after)

The most notable change here is that I limited the content size to about 1000px. Long lines are hard to read, so I added this little quality-of-life improvement for desktop users.

image image

The sidebar can also be closed on desktop:

image

Video

https://github.com/ruby/rdoc/assets/20938712/0aabe07f-4c9e-409f-8e28-2222881320ea

Testing

I wasn't sure if this change required tests. LMK if I need to add them.

MatheusRich avatar Jul 05 '23 23:07 MatheusRich

Thank you, seems very nice. Just one concern, when resizing the navigation pane, the menu icon doesn't move.

nobu avatar Jul 06 '23 04:07 nobu

when resizing the navigation pane, the menu icon doesn't move.

@nobu, I totally missed that it is resizable! Would it be a problem if we make it fixed-sized? I think that would be a small sacrifice for a simpler solution.

Edit: I made the sidebar fixed-sized.

MatheusRich avatar Jul 06 '23 11:07 MatheusRich

@nobu could you approve the workflow so we can see if this works on CI? Thank you!

MatheusRich avatar Jul 12 '23 20:07 MatheusRich

It looks like the tests breaking here are the same as the ones in the main branch.

MatheusRich avatar Jul 13 '23 15:07 MatheusRich

@nobu @hsbt is there something I can do to move this forward?

MatheusRich avatar Jul 18 '23 14:07 MatheusRich

@nobu @hsbt I've rebased this PR. CI should pass now.

MatheusRich avatar Jul 21 '23 17:07 MatheusRich

Sorry to ping you again, @nobu. Can we get a second look at this?

MatheusRich avatar Sep 21 '23 20:09 MatheusRich

cc @eregon @hsbt

MatheusRich avatar Oct 27 '23 20:10 MatheusRich

@peterzhu2118 can you take a look at this?

MatheusRich avatar Jan 04 '24 00:01 MatheusRich

@hsbt any plans on merging this (or not)?

MatheusRich avatar Mar 15 '24 14:03 MatheusRich

I have no opinion that.

@nobu How about your opinion?

hsbt avatar Mar 18 '24 01:03 hsbt