-
Notifications
You must be signed in to change notification settings - Fork 7
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
New article: Lazy enumerator trick #337
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why an iframe? So I can host the demo js on a separate static site and can avoid adding all those dependencies to Joy of Rails. Why a turbo frame? So we can add pass some custom query params to get the theme of the demo.
A bit convoluted here, but continuing down this path of keeping the demo JS in a separate repo: we want to request an iframe URL with query params with color scheme choices. Dark mode is not kept on the server at the moment, so I use a Stimulus controller to set the final turbo frame url on the frontend which is later converted to the appropriate iframe url on the backend. Send query params from Ruby to JS to Ruby to JS!!!
With the JS controller I added previously to update the frame src, there’s no real need to go to the server for the color scheme since we can query CSS variables from JS.
49bf68d
to
b8bb2e6
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New article time! This one embeds a small React app in an iframe.
I didn’t want to add React to the app just for the demo, so I built it as a separate standalone application hosted on Github pages. The source code lives at https://github.com/joyofrails/ruby-enumeration-demo.
This PR also adds some minor features like footer changes, an about me page, additional acknowledgements, improved text contrast in dark mode.