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

docs: layer model interactive component #17589

Merged
merged 15 commits into from
Sep 23, 2019
Merged

docs: layer model interactive component #17589

merged 15 commits into from
Sep 23, 2019

Conversation

gillkyle
Copy link
Contributor

@gillkyle gillkyle commented Sep 12, 2019

Description

In an effort to explain the GraphQL docs better I drew up what I thought would explain some of the "layers of Gatsby" as I thought of them. These are pretty simplified but generally express what happens in Gatsby in an order that shows data going all the way from a source to being consumed in a component.

I did some hacking to make the Content layer have the data be able to cycle through different data sources that all have the same simple content to express that data can come from anywhere and all ends up looking the same in the GraphQL layer.

I petitioned @fk for some design critiquing and used his input to clean up the design to make it less busy.

layers-model

Added the component to a handful of guides in the Conceptual section where I think it could do the most help expressing what's happening at different places.

Happy to hear any suggestions on how to improve content of each section, design, or whatever it may be.

Related Issues

Related to #15616 about adding more visual aids to docs (though this is about GraphQL, not themes like that issue mentionos)

This came about while working on the GraphQL workflow in #16981, trying to explain these concepts better

@gillkyle gillkyle requested review from a team as code owners September 12, 2019 15:21
@LekoArts LekoArts added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Sep 13, 2019
@LekoArts
Copy link
Contributor

I did some hacking to make the Content layer have the data be able to cycle through different data sources that all have the same simple content to express that data can come from anywhere and all ends up looking the same in the GraphQL layer.

It took me some time to get what "cycle" actually means in the context, so I'd propose to make the label more descriptive (e.g. "Cycle data source"). Longer text will impact your design, but I think this makes it more clear.


Love the general idea and execution, well done!

@gillkyle
Copy link
Contributor Author

Thanks for the review @LekoArts, I updated the button to say "cycle source" which I think would suffice 👍

@KyleAMathews
Copy link
Contributor

Nifty! Looks great

DSchau
DSchau previously approved these changes Sep 18, 2019
Copy link
Contributor

@DSchau DSchau 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! Left a number of (non-blocking) comments!

www/src/assets/icons/layer-icon.js Show resolved Hide resolved
www/src/components/layer-model/layer-content-sections.js Outdated Show resolved Hide resolved
www/src/components/layer-model/layer-content-sections.js Outdated Show resolved Hide resolved
www/src/components/layer-model/layer-content-sections.js Outdated Show resolved Hide resolved
www/src/components/layer-model/layer-content-sections.js Outdated Show resolved Hide resolved
www/src/components/layer-model/layer-content-sections.js Outdated Show resolved Hide resolved
Copy link
Contributor

@marcysutton marcysutton left a comment

Choose a reason for hiding this comment

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

This is amazing! Thanks so much for working on it. And great job making it accessible! I think this will help a lot of Gatsby learners to get a mental model of how it works. Way to take the initiative 🌮

www/src/assets/icons/layer-icon.js Show resolved Hide resolved
www/src/assets/icons/layer-icon.js Show resolved Hide resolved
www/src/assets/icons/layer-icon.js Show resolved Hide resolved
www/src/assets/icons/layer-icon.js Show resolved Hide resolved
docs/docs/querying-with-graphql.md Outdated Show resolved Hide resolved
www/src/components/layer-model/layer-model.js Show resolved Hide resolved
www/src/components/layer-model/layer-model.js Show resolved Hide resolved
docs/docs/gatsby-lifecycle-apis.md Outdated Show resolved Hide resolved
docs/docs/building-with-components.md Outdated Show resolved Hide resolved
docs/docs/gatsby-lifecycle-apis.md Show resolved Hide resolved
@gillkyle gillkyle added the status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response label Sep 20, 2019
Copy link
Contributor

@marcysutton marcysutton left a comment

Choose a reason for hiding this comment

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

In testing this some more, it's working well with the arrow keys, and with Voiceover and NVDA!

To make the tabs work as a single tab stop though, they need to have what's called roving tabindex, where only one of the tabs is focusable at a time but the arrow keys cycles through them. It would also help solve the issue where if the middle tab is selected by default, tabbing through the page won't put you on the first (inactive) tab. The goal is so that users don't have to tab through all the tabs to get to focusable items in the active tab panel content.

@gillkyle
Copy link
Contributor Author

Thanks @marcysutton! Awesome feedback! I'll fix that up now!

@muescha
Copy link
Contributor

muescha commented Sep 20, 2019

is there any chance to make this component more generic?

For example:

Cards for the upper big icons row

<cards default=“data” layout=“top-icon”>
  <card name=“data” icon=“data-icon” title=“Data Layer”>
    {children}
   </card>
   <card name=“Source” icon=“Source-icon” title=“Sourcing”>
    {children}
   </card>
</cards>

Tabs for the small code snippets

<tabs default=“Js” layout=“tabs-icon-and-text>
  <tab name=“Js” icon=“data-icon” title=“Data Layer”>
    {children}
   </tab>
   <tab name=“gql” icon=“gql-icon” title=“GraphQL”>
    {children}
   </tab>
</tabs>

Maybe we can combine the cards and tabs and only differnicate by a laout:

The hole is:

  • a Big Icons on top layout.
  • Content below

The code snippes:

  • small icons (for tech symbols depending on language) and a title
  • content below

Benefits:

  • reusable. I dreaming all time of a language toggle tab layout to display yarn commands instead of the npm (selected language is stored)
  • content stays only in doc document and is available for translation team

@muescha
Copy link
Contributor

muescha commented Sep 20, 2019

As a fast Google search: there also react compontens in the wild, but I don't know how well the fit: all under the keyword:

React content tabs

@gillkyle
Copy link
Contributor Author

@muescha I wasn't sure it was worth the effort of making it more generic at this point because I couldn't think of many more use cases. Having an npm/yarn toggle could be similar but might have different requirements and could probably happen in a PR for something more specific like that.

@muescha
Copy link
Contributor

muescha commented Sep 20, 2019

Reusable is one side effect

But i18n is on the way - and for this all text should stay in /docs/

gatsbyjs/rfcs#42

@jonniebigodes
Copy link

@gillkyle awesome job. i've gone over it and it looks awesome.

@muescha if by more generic you mean abstracting it to allow the content/text of the component to be translated to someone that visits the page. I think it's best to leave it as is for now until we a solid foundation in the translation effort. A mid future goal should be have a good portion of the documentation already translated in some languages. A more end goal would components like this one that was created and possibly others.

@muescha
Copy link
Contributor

muescha commented Sep 21, 2019

Generic i mean that all the localized content is in doc. Presentation is in the component

Like my draft code example: {children} is any content from the mdx doc page

@marcysutton
Copy link
Contributor

@muescha perhaps that could be discussed later for a future enhancement? I'd prefer to keep the scope of this limited so we can move it forward.

Copy link
Contributor

@marcysutton marcysutton left a comment

Choose a reason for hiding this comment

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

This is awesome. Nice work, @gillkyle! Thanks for incorporating the feedback 🌻

@gillkyle gillkyle removed the status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response label Sep 23, 2019
@gillkyle gillkyle merged commit 4af3f91 into master Sep 23, 2019
@gillkyle gillkyle deleted the layer-model branch September 23, 2019 18:34
@alexlobera
Copy link
Contributor

alexlobera commented Sep 25, 2019

@gillkyle I think this visual representation is a big step to illustrate the process, it's helped me understand the puzzle much better. Although it's very helpful, I got a bit confused with the "build" concept. I see in the text that "build" refers to the process itself and it's also used in one of the tabs as a step in the process as well. It also confuses me a bit to use the GraphQL logo in the tab that displays a JSON and not on the previous one where the GraphQL query is.
image

What I understood from the examples is that during the build process the "content" is "queried" to get "data" for the "view" to be rendered in the "app", meaning:

image

Sorry for the late feedback :)

@muescha
Copy link
Contributor

muescha commented Sep 26, 2019

mhh also i miss there a "import data" build step where it is said that data is fetched imported into the gatsby data warehouse in graphql. it says only "can be connected to Gatsby" but not exactly where the data is stored.

i see it is in the build step. but in wrong order.

expect there a more detailed description in this order for build:

  • fetch data from all sources and import to GraphQL schema
  • transform data to enhance data, optimize images
  • compile application
  • query data from GraphQL and inject into templates
  • then at least optimization, code splitting etc.

@gillkyle
Copy link
Contributor Author

@alexlbr this is great feedback!

I think in order to resolve that confusion maybe the right move would be to move the information in the build step (those 2 paragraphs on the right in what is currently the build layer) into the initial content step and explain that at that point the content gets pulled from different places and a schema is made all during Gatsby's processing.

I like the idea of moving that up, I wonder if anyone else from @gatsbyjs/learning has any thoughts?

@muescha I think for clarity the build step could be reworded, though if changes are made to resolve what @alexlbr found confusing perhaps that would fix that anyway. I didn't include really granular details about the build on purpose because this is a pretty conceptual thing, though I'm happy to hear how you'd reword it!

@muescha
Copy link
Contributor

muescha commented Sep 26, 2019

@gillkyle 👍

yes you are right, too much granular would be not good. my thing was just an expectation and can be reworded be more short, like the suggested changes in your answer to @alexlbr

@DSchau DSchau restored the layer-model branch October 3, 2019 18:39
@LekoArts LekoArts deleted the layer-model branch October 3, 2019 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants