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

Kit Updates #77

Merged
merged 39 commits into from
Jun 22, 2018
Merged

Kit Updates #77

merged 39 commits into from
Jun 22, 2018

Conversation

emplums
Copy link

@emplums emplums commented Jun 19, 2018

This PR is getting quite large so I'm going to stop here! There are still a few extra things I'd like to do (listed below) but this feels like a good stopping point :) Here's what I've done in this PR:

  • Use object format for examples (necessary in order to use the renderSideNav feature from Kit)
  • Move examples into individual files
  • Move <head> into _app.js (including links & meta data in package.json was not working)
  • Top navigation
  • separate Libraries for presentational & demo components
  • v1 Sandbox
  • Primer styles for sidebars and top nav
  • Fix HMR

Issue: #80

To do in future PR:

Changes to our development workflow:

  • After completing a component, create a new example file in the component-examples folder and include an example for your new component.
  • Consider whether including a PropsForm or LiveEditor would make sense for your example
  • export your example in the index.js file in component-examples
  • Check out your cool new component in Kit! 🎉

cc @primer/ds-core

This reverts commit 66b16a6.
@emplums emplums changed the base branch from master to release-0.0.5-beta June 21, 2018 18:44
Copy link
Member

@broccolini broccolini left a comment

Choose a reason for hiding this comment

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

Pulled this down locally to test out because the pages preview doesn't seem to be working. Locally it all looks good to me.

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

Nice big change 👍 I only had one question involving where to place react-router-dom otherwise looks good

package.json Outdated
},
"dependencies": {
"@github/octicons-react": "1.2.0-alpha.0a0d8862",
"classnames": "^2.2.5",
"d3-shape": "^1.2.0",
"react": "^16.2.0",
"react-router-dom": "^4.3.1",
Copy link
Member

Choose a reason for hiding this comment

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

I tried to understand react-router-dom to see if it's related to the demo and only needed to be in devDependencies?

I couldn't figure it out, so just posing the question here. ✌️

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Unless we're using it in any of the classes exported by src/index.js, it should only be a dev dependency.

Copy link
Author

Choose a reason for hiding this comment

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

👍

@emplums
Copy link
Author

emplums commented Jun 22, 2018

@broccolini to get pages working you have to add /docs to the end of the url, it;s because we had to rename Index.js to doc.js to get HMR working so the static build is generating a docs folder with an html file in it instead of a plain index.html. I've documented that & another url issue in #84

examples/docs.js Outdated
</nav>
<Route path='/docs/components' component={ComponentPage} />
<Route path='/docs/demos' component={DemoPage} />
<Route path='/docs/sandbox' component={Sandbox} />
Copy link
Member

Choose a reason for hiding this comment

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

Routes are created based on files with x0 so you don’t need to add routes. You can do this but it will actually stop pages being statically rendered which is handled by x0

Copy link
Member

Choose a reason for hiding this comment

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

^ @emplums This was showing as a pending comment so I'm unsure if you already saw it and whether the #77 (comment) is responding to it 🙈

Copy link
Contributor

Choose a reason for hiding this comment

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

I was confused by this. Does it effectively alias those paths to wherever the ComponentPage, DemoPage, and Sandbox pages end up?

Copy link
Author

Choose a reason for hiding this comment

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

@broccolini I tried not including s first and it wasn't working 🤷‍♂️ All the x0 docs say is To link between different components, install react-router-dom and use the Link component. (I'm using NavLink here to get the active styling, but I've tried with plain Links too). I'm not sure if the file structure needs to be set up for a certain way to get this to work correctly, our x0 config needs something extra to get this to work, or if there's a bug?

The only way I could get this working was to set up <Route> components as well. It works on the built gh pages site too. I can ask the x0 team for further details in getting <Link> to work out of the box, but any changes to routing ends up taking a while to test that it doesn't break HMR and also doesn't break the static build so I'd like to wait until after the release to fix that if that's cool!

Copy link
Author

Choose a reason for hiding this comment

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

Just kidding I take everything back 😹 It looks like issue was that built in routing only works from _app.js, if we move all the navigation there it works fine! Plus HMR still works, plus we finally have some permalinks that work 🙀 I don't think we need a docs.js/index.js file at all, all of that can go right in _app.js instead.

There's still a few things that need to be addressed with this change post-release:

  • setting the basename for the library components to /primer-react/components makes the URLs correct on the static site so that permalinks work, but it breaks HMR locally.
  • We still have an issue with the base url for gh-pages being /primer-react which doesn't load anything, we have to navigate to one of the pages /primer-react/components to see content.

I think both of those issues can be easily solved though! 🎉

@emplums emplums merged commit 1918c5a into release-0.0.5-beta Jun 22, 2018
@emplums emplums deleted the kit-updates branch June 22, 2018 18:18
@shawnbot shawnbot mentioned this pull request Jun 22, 2018
3 tasks
@shawnbot shawnbot mentioned this pull request Jul 20, 2018
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.

4 participants