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

[WIP][www] Sidebars à la reactjs.org (accordions, scrollspy) #6153

Merged
merged 12 commits into from
Jun 27, 2018

Conversation

fk
Copy link
Contributor

@fk fk commented Jun 26, 2018

…this time against master instead of v1 (ref. #6076 and fk#2).

fk added 2 commits June 26, 2018 02:19
…this time against master instead of v1 ✨
# Conflicts:
#	www/src/templates/template-docs-markdown.js
@gatsbybot
Copy link
Collaborator

gatsbybot commented Jun 26, 2018

Deploy preview for gatsbygram ready!

Built with commit 6769c19

https://deploy-preview-6153--gatsbygram.netlify.com

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jun 26, 2018

Deploy preview for using-drupal ready!

Built with commit 6769c19

https://deploy-preview-6153--using-drupal.netlify.com

@@ -4,7 +4,7 @@ const path = require(`path`)
const parseFilepath = require(`parse-filepath`)
const fs = require(`fs-extra`)
const slash = require(`slash`)
const slugify = require(`limax`)
Copy link
Contributor

Choose a reason for hiding this comment

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

btw, is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ReactJS implementation uses slugify to construct URLs on client side. Initially I copypasta'd that and switched to slugify because limax is quite a bit heavier.

Then I changed the implementation to directly use the yamls href value, so we don't need slugify on the client anymore; left slugify in there because for us they both work the same essentially.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Yes! ;-))

width: rhythm(12),
},
[presets.Hd]: {
width: rhythm(14),
Copy link
Contributor

Choose a reason for hiding this comment

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

can we get rid of this setting? It feels really wide here on my 15" screen -- and window isn't even fully expanded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@calcsam
Copy link
Contributor

calcsam commented Jun 26, 2018

Looks great! Only question is my previous one:

It's easy see how we could expand the Docs section to add in new Docs sections. How will this work on the tutorial section? Main question is -- how will subsequent tutorials be discoverable, since everything we put after the main tutorial series will be so far below the fold? Collapse everything by default? Nest everything under a Introduction to Gatsby section that is opened by default on the /tutorial route, that can be fully collapsed with one click? Etc.

calcsam
calcsam previously approved these changes Jun 26, 2018
Copy link
Contributor

@calcsam calcsam left a comment

Choose a reason for hiding this comment

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

Looks great!

@m-allanson
Copy link
Contributor

m-allanson commented Jun 26, 2018

Looking good! Preview URL: https://deploy-preview-6153--gatsbyjs.netlify.com/

I changed a Bound Action Creators to Actions.

Some thoughts / questions:

  • Is it possible to update the scroll position of the sidebar when changing pages in the mobile layout?

    In a small browser window:

    The menu will open with the scroll position set to 0, instead of being scrolled to the currently selected page.

  • Would it be useful for the top level docs headers to link through to their own page for non-JS users?

    • disable JS

    • go to https://deploy-preview-6153--gatsbyjs.netlify.com/docs/

    • click a top level heading like Guides or Reference

    • nothing happens :)

      A fix would be to create a page for each top level item and have the sidebar link to those pages for non-JS users. I realise this is probably out of scope and probably not that important. Feel free to ignore!

Edit: my commit dismissed @calcsam's review, you should consider this still approved by him ✅.

@fk
Copy link
Contributor Author

fk commented Jun 26, 2018

@m-allanson

I changed a Bound Action Creators to Actions.

D'oh, thanks for catching that! And I was so proud for catching the changed link and Tutorial Part 8! ;-)

Is it possible to update the scroll position of the sidebar when changing pages in the mobile layout? The menu will open with the scroll position set to 0, instead of being scrolled to the currently selected page.

👍 Yeah for sure! We also want that for desktop, same issue there with the stuff further down.

Would it be useful for the top level docs headers to link through to their own page for non-JS users?

Yeah, also wondered about that. Also I think we either need to throw in a <h3> again (this currently just uses a <button>) or update how we feed data to Algolia:

image

# Conflicts:
#	www/src/components/sidebar-body.js
@m-allanson
Copy link
Contributor

@fk 👍 The selectors used by Algolia are configured over here https://github.com/algolia/docsearch-configs/blob/master/configs/gatsbyjs.json#L36.

fk added 4 commits June 27, 2018 14:32
* measure banner/navigation offsetHeight instead of hardcoding offset pixel value (WiP, doesn’t take non-fixed navigation on smaller screens into account yet)
* right-aligned, calmer chevron
* add visual separator for expanded section
* bring „Tutorial“ bullets in line with design
* increase sidebar inner whitespace
* bring back SectionTitle <h3> (Algolia; IIRC this is semantically incorrect -> WiP)
@fk
Copy link
Contributor Author

fk commented Jun 27, 2018

@m-allanson aceb421 brings back <h3> to the section titles.

I just chatted about this PR with @calcsam a few minutes ago. We decided to merge this as-is and follow up with issues tracking the remaining work.

@fk
Copy link
Contributor Author

fk commented Jun 27, 2018

Can I get another review @calcsam? 🙏 😉

m-allanson
m-allanson previously approved these changes Jun 27, 2018
Copy link
Contributor

@m-allanson m-allanson left a comment

Choose a reason for hiding this comment

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

👍

let { isActive } = this.props
if (section.disableAccordions) {
isActive = true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

don't modify props -- do something like:

const isActive = this.props.isActive || section.disableAccordions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh dang! 😁 Babysteppin'…

@calcsam
Copy link
Contributor

calcsam commented Jun 27, 2018

Did a quick scan and looks good!

fk added 3 commits June 27, 2018 19:23
Making „Awesome Gatsby“ a subitem was just to test functionality.
@fk fk merged commit 3809d03 into gatsbyjs:master Jun 27, 2018
@fk
Copy link
Contributor Author

fk commented Jun 28, 2018

It's easy see how we could expand the Docs section to add in new Docs sections. How will this work on the tutorial section? Main question is -- how will subsequent tutorials be discoverable, since everything we put after the main tutorial series will be so far below the fold? Collapse everything by default? Nest everything under a Introduction to Gatsby section that is opened by default on the /tutorial route, that can be fully collapsed with one click? Etc.

Finally getting through to answer this, sorry for taking so long @calcsam.

I'd split the current/main Tutorial contents into collapsible parts/groups and automatically expand the first—essentially what you suggest in your last sentence.
That should cover the need of people new to Gatsby and the Tutorial section in particular. If we implement storing the state of accordions in local storage or a cookie, people can move through the tutorial without having to manually navigate to the part of the tutorial where they stopped at.

@calcsam
Copy link
Contributor

calcsam commented Jun 28, 2018

Awesome, thanks for the explanation @fk !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants