-
Notifications
You must be signed in to change notification settings - Fork 321
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
docs: add edit mode for stories in docs page #2043
docs: add edit mode for stories in docs page #2043
Conversation
… that includes a live editor
…corator, add custom padding
… to scope of live edit
prettier fails because the parsing method at withLiveEdit is currently not generic enough
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.
This is freaking amazing!!!! 👑 💯 💪🏼
packages/core/src/storybook/components/canvas-wrapper/CanvasWrapper.tsx
Outdated
Show resolved
Hide resolved
|
||
const toggleCodeAction = useMemo( | ||
() => ({ | ||
title: "Toggle code editor", |
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.
Suggestion: call it "Play"
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.
Just like that? Play?
It opens and shut the live editor, not sure about Play
packages/core/src/storybook/components/canvas-wrapper/CanvasWrapper.tsx
Outdated
Show resolved
Hide resolved
packages/core/src/storybook/decorators/withLiveEdit/withLiveEdit.tsx
Outdated
Show resolved
Hide resolved
code={code} | ||
theme={vscodeDark} | ||
extensions={[langs.tsx()]} | ||
style={{ fontSize: 13 }} |
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.
On purpose?
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.
Yep, I want it to look same as Source, that's why I chose this theme and font size, to mimic as best as possible
https://monday.monday.com/boards/3532714909/pulses/5898424178
API:
scope
can be any component or helper function.so, it can be
someText
var that is a stringand it can be a component
whatever which is a key-value obj that you want the react-live's preview to know
The only thing needs to be done to enable LiveEdit for an existing component is simply removing the Canvas import in the MDX
If you'd like to disable for specific story (e.g. the Overview story), just set in its CSF the
isEnabled: false