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

[v1.0] Documentation improvements. #1370

Merged
merged 2 commits into from Jul 6, 2017
Merged

[v1.0] Documentation improvements. #1370

merged 2 commits into from Jul 6, 2017

Conversation

Vagr9K
Copy link
Contributor

@Vagr9K Vagr9K commented Jul 5, 2017

This PR completes the Building with Components documentation page.

I tried to keep following the outline as much as I could, but ended up describing the whole project structure. I'm not completely sure whether that should be in the same page, or a different one.

Suggestions are welcome :)

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jul 5, 2017

Deploy preview ready!

Built with commit 93cf28b

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

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jul 5, 2017

Deploy preview ready!

Built with commit 93cf28b

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

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jul 5, 2017

Deploy preview ready!

Built with commit 93cf28b

https://deploy-preview-1370--gatsbyjs.netlify.com

Copy link
Contributor

@KyleAMathews KyleAMathews 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 great! I hadn't thought about using this page to do an overview of the different ways components are used. Works great!

* All Gatsby site UI is built with React components.
* Concise description of why components amazing model for building sites.
* Perhaps link to other good articles on "Why components are amazing".
You'll need to have basic understanding of React components.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps "To use Gatsby, you will need a basic understanding of React components"


## Why React components?

React allows to create big complicated webapps while preserving modularity, reusabilty, and clear abstraction. React also has great devtools available for debugging the applicattion.
Copy link
Contributor

Choose a reason for hiding this comment

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

React allows creating|building big...


## How does Gatsby use React Components?

Everything in Gatsby is built using Components.
Copy link
Contributor

Choose a reason for hiding this comment

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

lower-case c in components


### UI Layouts

`src/layouts/index.jsx` (optional) is a wrapper component for everything generated by Gatsby. You can use it to create consistent layouts between pages.
Copy link
Contributor

Choose a reason for hiding this comment

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

"wraps page components. You can use use it for site-wide parts of the site like headers and footers."


### Page generation

Components under `src/pages` are being automatically mapped to HTML files with respective paths. For example `src/pages/index.jsx` is mapped to `yoursite.com` meanwhile `src/pages/about.jsx` is `yoursite.com/about/`.
Copy link
Contributor

Choose a reason for hiding this comment

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

"mapped to pages with paths based on their file name"


Everything in Gatsby is built using Components.

A basic directory structure of a project looks like this:
Copy link
Contributor

Choose a reason for hiding this comment

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

"might look like this:"


You may have noticed that `src/pages/posts` also contains markdown files. You can transform any file into HTML pages using [Gatsby plugins](https://www.gatsbyjs.org/docs/plugins/).

### Templates
Copy link
Contributor

Choose a reason for hiding this comment

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

Page templates


### Templates

`src/templates/post.jsx` (optional) is a component that queries GraphQL database for markdown information, and then generates HTML based on it.
Copy link
Contributor

Choose a reason for hiding this comment

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

is an example of a page component. It queries the GraphQL schema for markdown data and then renders the page using this data.

`
```

Please note, that for this to work, you'll also need to configure:
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace this last section with something like: "These are examples of the different ways React components are used in Gatsby sites. To see full working examples, check out the examples directory in the Gatsby repo". And link that last bit.

@Vagr9K
Copy link
Contributor Author

Vagr9K commented Jul 6, 2017

My not so native english showed itself again...
Updated PR as requested :)

@KyleAMathews
Copy link
Contributor

haha that's why you have an english-speaking editor! You supply the ideas and we supply the polished prose :-)

@KyleAMathews
Copy link
Contributor

thanks!

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

3 participants