Issue #241
Issue: #241
Approach
- Added
src/_includes/body.htmlto make react available on jekyll pages - Included
body.htmlinsrc/_layouts/page.html - Created simple react components in
src/assets/js/react-compopnenets.jsto fetch code.mil/code.json
I used plain React to build a simple ProjectList component that fetches and renders basic information from code.json file.
Please review and suggest changes, as this is my first pull request.
Thanks @b-d055! Unfortunately I can't preview this because our content security policy blocks the links out to React. We'd need to pull those resources into local context.
Somewhat related though... I struggle to justify including all (most) of React for a single page that has no dynamically updating content. Seems like a simple fetch() and then build of the page elements would be pretty easy. Or even a server-side rendering of the page.
Curious to get @jgarber623-gov's thoughts.
Ah yes, I see that now. I'll try bringing those external resources in locally.
And I think you're right about including all of React. However, if this project wants to be more like code.gov, perhaps it'd be beneficial in the long term? I'm thinking this could be built upon to include a more dynamic search screen with filters and/or search boxes and other, more dynamic goodness in the future.
There's also https://preactjs.com/ as an alternative.
Just my initial (perhaps naive) thoughts!
I'm with @jordangov on this one. There are a few ways that we could address #241 without introducing a hefty dependency like React:
- Use Jekyll's native data file processing to generate an inventory page when the site builds and deploys,
- Use Jekyll's plugin architecture to write a little bit of Ruby to do the same.