dennisreimann / uiengine

Workbench for UI-driven development
https://uiengine.uix.space/
MIT License
366 stars 25 forks source link

🍭 ui: add back component rendered source #54

Closed therealpecus closed 4 years ago

therealpecus commented 4 years ago

Describe the changes Fixes #43 This PR restores the HTML code panel. The rendered HTML is sourced by fetching the document displayed in the preview iframe. It runs at render time of the component instance, and the slight delay between the component setup and content display is handled by a loading state (localized).

A new config option (componentCommentDelimiter) has been added to avoid outputting conditional comment blocks around the rendered template: <!-- uiengine:preview:start --> ... <!-- uiengine:preview:end -->. It defaults to true. Setting this flag to false would not output the comment tags in the rendered html; the HTML code panel would show the full HTML document.

This last contribution can be removed if out of scope for this feature, but since I had already coded it I left it as a topic to discuss during the code review.

πŸ›Ž Household chores missing: commits should be squashed before merge.

Steps to check the contribution

  1. Build the project yarn build
  2. Start the test project yarn run test-project
  3. Click on Pattern Library/Atoms/Label (http://localhost:3000/patterns/atoms/label/#label-label-html-3)
  4. Click on the code label for any variant
  5. Click on HTML
  6. The rendered HTML code should be displayed after a slight delay

Checks to pass [x] Linting still works [x] Unit tests are passing [x] Acceptance tests are passing [x] Commit messages start with a somehow fitting emoji

therealpecus commented 4 years ago

I hit resolve thinking I could comment... I'll push the changes and resolve it later

dennisreimann commented 4 years ago

Thank you very much! I will take a closer look soon :)

dennisreimann commented 4 years ago

Hey @therealpecus, I reviewed this and found a few things that needed minor tweakings, which I did in bdb47bf33dfd922c6a526c94d1e1d685276e5c4e.

Can you have a look at the changes and cherry-pick the commit to be included in this PR?

In particular:

Thanks for taking care of this, I really appreciate it!

dennisreimann commented 4 years ago

I now also rebase the branch with the current master – is it good to go from your perspective?

therealpecus commented 4 years ago

Sorry @dennisreimann I did not have time to look back into it. At a glance I'd say all is good, and thanks for the finishing touches. I might not find a break to give proper time to this before next week 😞

dennisreimann commented 4 years ago

No hurry :)

dennisreimann commented 4 years ago

Rebased and merged manually, see a39849b0d63060a5f056086400b1a89c266aa1a0.

Thanks again @therealpecus!