Closed mletic closed 1 year ago
Closing this; soon we will be adding StackBlitz examples (based on https://github.com/foursquare/unfolded-sdk-examples/pull/57#issuecomment-1485430806), and recently we decided internally to use StackBlitz over alternatives (CodePen or CodeSandbox).
The idea behind this PR is to allow developers using our SDK to be able to open the example on CodePen, without making any modifications to the html or js that are specific for the CodePen API.
Using this approach we can support both
Open in GitHub
andOpen in CodePen
badges at the top with one codebase, with clean code. The idea is to embed these small examples in our API functions documentation pages.This
addToCodePen
function will be moved to another file that our examples can call. There we can escape characters forhtml
andjs
code that is needed for this to work with CodePen and it won't have any effect on our code so that our examples are always functional and free of any CodePen specific code.There are a couple of flaws (but those are limitations in CodePen):
Preview (feel free to test the html yourself):