Skip to content
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

Allow option for react component preview to show alongside the code. #29

Open
preshonyee opened this issue Sep 6, 2020 · 4 comments
Open

Comments

@preshonyee
Copy link

Current situation analysis

Right now, the current way to preview react components doesn't offer a good user experience. It's requires a lot more cognitive effort to always keep in mind the state of the output while navigating the code.
image

Proposed solution

A better solution would be one that allows the code and the output to be visible side by side, at the same time. In my opinion, this would tremendously improve the user experience for users navigating a site using dokz.
This is exactly what code-sandbox and in some way codepen does. Which is really good.
image

Alternative

I understand a different implementation might be much more complex, in that case, below is an alternative solution to the problem and is good too. This solution shows the code beneath while the output is shown above at the same time. The only issue with this might be instances where the lines of code are quite much and requires the page to be scrolled. down more.

image

image

@preshonyee
Copy link
Author

@remorses seen this yet?

@remorses
Copy link
Owner

Yeah, i think the current approach is fine in my opinion

You can open a PR if you want with a new playground

The current playground works this way

  • it accepts a code prop injected at compile time with the jsx code from inside playground
  • it accepts a scope prop with the current file imports (there should also be exports but is not working currently)
  • these props are injected to all components with name Playground

You can even import a playground from another npm package if you want

@remorses
Copy link
Owner

You can use the current playground as an example

export const Playground = ({

@preshonyee
Copy link
Author

thanks a lot...i'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants