-
Notifications
You must be signed in to change notification settings - Fork 734
Usage component support live preview for compatible components #3581
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
Conversation
Note:
This line takes the |
</CodeBlock> | ||
</div> | ||
return componentLivePlaygroundSupport ? ( | ||
<UILivePreview code={code}/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to prettify the code, Nitzan did it in another use case, check with him
|
||
export const Usage = ({component}) => { | ||
const componentLivePlaygroundSupport = !!ReactLiveScope[component.name]; | ||
const code = component.snippet?.map(item => _.replace(item, new RegExp(/\$[1-9]/, 'g'), '')).join('\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this line of code to after the check if a snippet exists
</CodeBlock> | ||
</div> | ||
return componentLivePlaygroundSupport ? ( | ||
<UILivePreview code={code}/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the code doesn't update in runtime, it stuck on the snippet
if the user plays with the code it doesn't reflected in the preview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UILivePreview
has his own code state management, the LiveProvider
handels it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it works?
If the user changes the code it applies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it works for me
So maybe I had another issue, I'll approve
Let's merge this and fix the formatting in another PR
Now LivePreview will be shown only for supported components otherwise it will show CodeBlock.
I have some issue with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving.
I see it works for me now, we can fix the formatting in another PR
Description
Docs -
Usage
section, should show live playground or code block.If the component is part of the
ReactLiveScope
we should show live playground else code block.Old PR - closed because of the
api
files.Changelog
Docs -
Usage
section, should show live playground or code block.Additional info
None