feat(playground): Add 'Open in Playground' button to learning modules#872
feat(playground): Add 'Open in Playground' button to learning modules#872karanpatill wants to merge 4 commits intoaccordproject:mainfrom
Conversation
Signed-off-by: karanpatill <karanpatil82005@gmail.com>
✅ Deploy Preview for ap-template-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks @karanpatill for working on this! Great to see this being implemented based on the issue (#871). I’ll check out the preview and share any thoughts if I notice something useful. |
|
@Atharva7115 can you share a link to your preview here, please? As the author of the issue, you get priority for the PR to fix the issue |
|
@mttrbrts Thanks for the opportunity! |
|
@mttrbrts Thanks for the opportunity! I’ve created a PR for this: #877 Looking forward to your feedback. |
|
Thanks for this contribution @karanpatill! The "Open in Playground" button is a nice UX improvement for bridging learning content with hands-on practice. Review NotesCode Changes Look Good
Questions
Deploy Preview: https://deploy-preview-872--ap-template-playground.netlify.app This comment was generated by AI on behalf of @mttrbrts. |
5863d25 to
c2d8030
Compare
There was a problem hiding this comment.
Thanks for working on this, @karanpatill — the implementation looks clean and integrates well with the learn → playground flow.
A couple of small suggestions:
-
Theme consistency
The button color is currently hardcoded (#19c6c7). It might be worth using the existingcolors.primarytheme token to stay consistent with the rest of the codebase and ensure future theme updates are applied uniformly. -
Fallback for invalid sample
If an invalid?sample=value is provided,loadSamplemay fail silently and skiprebuild(), potentially leaving the app uninitialized. It might be worth adding a small validation or fallback to ensure the playground always initializes correctly.
Signed-off-by: karanpatill <karanpatil82005@gmail.com>
0345275 to
da55deb
Compare
Signed-off-by: karanpatill <karanpatil82005@gmail.com>
|
Thanks for the review and suggestions! I’ve updated the implementation to use the theme’s colors.primary for consistency, and added a fallback to handle invalid ?sample= values so the Playground initializes correctly in all cases. There was a build issue in the initial update, which has now been resolved — the latest commit includes the fix and the checks should now pass. Please let me know if any further changes are needed. |
Signed-off-by: karanpatill <karanpatil82005@gmail.com>
Add 'Open in Playground' button to learning modules
This PR integrates the Learning section with the Playground by adding a button in each module that automatically loads the corresponding sample into the editor.
Motivation:
Users often want to immediately try out the concepts they just read about in a module. This button bridges the gap between learning and practice, improving the overall developer experience.
Changes:
sampleNametosteps.tsto map modules to samples.LearnContentcomponent inContent.tsxto display the "Open in Playground" button.init()instore.tsto handle thesamplequery parameter for auto-loading.Content.tsxto resolve ESLint errors.Refs #871