-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Blocks rendering in Next.js (pages/mocked graphql calls) #102
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
Conversation
|
@moonmeister do you think it's fine enough or am I missing something? If you think it satisfies the ticket, we can open it for review. |
theodesp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
josephfusco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahuseyn Nice work! I left some minor suggestions.
Co-authored-by: Joe Fusco <[email protected]>
Co-authored-by: Joe Fusco <[email protected]>
Co-authored-by: Joe Fusco <[email protected]>
|
Thanks @theodesp and @josephfusco. I've committed your suggestions. |
|
@ahuseyn PR looks awesome 🚀 I added 2 small suggestions in the README. Also happy to help out with setting up wp-env if that is something you want to use 😄 |
Thanks @colinmurphy. For this example we've decided to go with mock graphql requests, but I'm planning to add your wp-env implementation to Apollo example and other future examples. |
colinmurphy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 🚀 🚀
No worries. Happy to help once we have the other PR merged aswell for WP ENV and we can workout next steps :) |
Example: Rendering WordPress Blocks in Next.js
This example demonstrates rendering WordPress Blocks with JSX in a Next.js project. The example includes 16 block components across various categories. Example includes a utility to convert flat blocks data from GraphQL (GQL) response into the hierarchical data structure. Passing this data into BlockRenderer component generates the WordPress content by matching the appropriate blocks and using a default block when block implementation is missing. Default block is also customizable component. Example also gives an option to provide custom HTML parser to render HTML content.
Features
Important notes
pages/index.jsfile.wp-graphql-content-blocksandWPGraphQLplugins installed if you want to connect it to a WordPress instance.Project structure
Installation and Setup
Prerequisites
Clone the repository
git clone https://github.com/wpengine/hwptoolkit.git cd examples/next/render-blocks-pages-routerInstall dependencies
Start the development server