-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Blocks: Canvas stories #19804
Blocks: Canvas stories #19804
Conversation
}; | ||
|
||
// TODO: what is the purpose of mdxSource exactly? | ||
export const WithMdxSource: Story = { |
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.
withSource?: SourceState; | ||
mdxSource?: string; | ||
}; | ||
|
||
const getPreviewProps = ( | ||
const usePreviewProps = ( |
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.
It turned out this was actually a hook, just not named as such (which surfaced errors)
withSource?: SourceState; | ||
mdxSource?: string; | ||
}; | ||
|
||
const getPreviewProps = ( | ||
const usePreviewProps = ( |
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.
The diff for this function may seem like a lot, but it maintains the exact same functionality and logic, it's just a refactoring. The refactoring was sparked by the need for useSourceProps
hook to be called unconditionally, and so in an attempt to figure the whole thing out I simplified the logic paths.
@@ -89,7 +89,7 @@ const getSnippet = (snippet: string, story?: Store_Story<any>): string => { | |||
type SourceStateProps = { state: SourceState }; | |||
type PureSourceProps = ComponentProps<typeof PureSource>; | |||
|
|||
export const getSourceProps = ( | |||
export const useSourceProps = ( |
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.
also a hook, actually.
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 great, love the tests.
…-898-blocks-canvas
…-898-blocks-canvas
This PR adds stories for the Canvas block, both for current features and deprecated features.
Most notably, Having non-story elements/components within a Canvas as well as having multiple stories is being soft-deprecated. This means that we won't be documenting it officially (so in this PR the stories for those use cases are internal, and not in the public Blocks SB), but because we haven't quite figured out the migration path off of this yet* we aren't showing any deprecation warnings yet. This was discussed with @shilman, but I'm open to any input.
* the migration path is likely the variants feature, which won't land for a while.