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 support for mobile screen sizes on Darkfish #1025
base: master
Are you sure you want to change the base?
Conversation
9b4893d
to
d88b2a0
Compare
@@ -0,0 +1,26 @@ | |||
<button id="navigation-toggle" class="navigation-toggle" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation"> | |||
<!-- | |||
Copyright (c) 2021 Luca Burgio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the right way to attach the license.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, maybe we could use U+2630 (☰) as an icon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or U+2261(≡)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this file does, but I added it for completeness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this file does, but I added it for completeness.
<nav id="navigation" role="navigation"> | ||
<div id="project-navigation"> | ||
<%= render '_sidebar_navigation.rhtml' %> | ||
|
||
<%= render '_sidebar_search.rhtml' %> | ||
</div> | ||
</nav> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this needs more content, but I needed a sidebar on this page. Otherwise, it's harder to return to the Home page.
min-width: 340px; | ||
font-size: 16px; | ||
width: 100%; | ||
max-width: 64em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, this could be even smaller.
Thank you, seems very nice. |
@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. |
@nobu could you approve the workflow so we can see if this works on CI? Thank you! |
It looks like the tests breaking here are the same as the ones in the main branch. |
f8345cc
to
aad7d9e
Compare
Sorry to ping you again, @nobu. Can we get a second look at this? |
@peterzhu2118 can you take a look at this? |
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]. [disclosure widget]: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/ [Iconoir]: https://iconoir.com/ [Elixir docs]: https://hexdocs.pm/elixir/1.15.2/Kernel.html
@hsbt any plans on merging this (or not)? |
I have no opinion that. @nobu How about your opinion? |
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)
Code blocks (before/after)
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.
The sidebar can also be closed on desktop:
Video
Screen.Recording.2023-07-05.at.19.59.33.mov
Testing
I wasn't sure if this change required tests. LMK if I need to add them.