code.mil icon indicating copy to clipboard operation
code.mil copied to clipboard

Issue #241

Open b-d055 opened this issue 7 years ago • 3 comments

Issue: #241

Approach

  • Added src/_includes/body.html to make react available on jekyll pages
  • Included body.html in src/_layouts/page.html
  • Created simple react components in src/assets/js/react-compopnenets.js to 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.

b-d055 avatar Mar 06 '19 15:03 b-d055

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.

jordangov avatar Mar 06 '19 16:03 jordangov

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!

b-d055 avatar Mar 06 '19 16:03 b-d055

I'm with @jordangov on this one. There are a few ways that we could address #241 without introducing a hefty dependency like React:

  1. Use Jekyll's native data file processing to generate an inventory page when the site builds and deploys,
  2. Use Jekyll's plugin architecture to write a little bit of Ruby to do the same.

jgarber623-gov avatar Mar 06 '19 16:03 jgarber623-gov