-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add isMDXComponent
static class prop to generated classes
#369
Conversation
Adds the behavior discussed in #368
This pull request is automatically deployed with Now. |
I'm sorry for all the commit spam, just wanted to try how the GitHub editor experience was 😝 |
isMDXComponent
static class prop to generated classesisMDXComponent
static class prop to generated classes
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.
🤙
Are there any blockers for this PR? I was wondering if we could have it merged. Many thanks. |
Maybe checking import ChangeLog from './changelog.mdx'
ChangeLog.displayName === 'MDXContent'
// or
ChangeLog.displayName.includes('MDX') |
This sadly didn't work for uglified builds where class names get changed. |
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 it might make more sense to make this a boolean rather than a function so folks don't have to do Component.isMDXComponent && Component.isMDXComponent()
.
Are you sure you didn't accidentally try And thanks for your work on this PR, I'm just curious. 😄 |
Co-Authored-By: hugmanrique <hugmanrique@users.noreply.github.com>
Co-Authored-By: hugmanrique <hugmanrique@users.noreply.github.com>
Thanks @hugmanrique! |
* Add `isMDXElement` static class prop to generated classes Adds the behavior discussed in #368 * s/element/component * Add isMDXComponent test * Define static class prop the old way * Fix prettier error * Revert new line removal * Fix prettier error * Add function to snapshot test * Missed a ; * Change isMDXComponent type to bool Co-Authored-By: hugmanrique <hugmanrique@users.noreply.github.com> * Apply suggestions from code review Co-Authored-By: hugmanrique <hugmanrique@users.noreply.github.com>
There's currently no way to detect whether a class was generated by
@mdx-js/mdx
, and this PR adds aisMDXComponent()
static class property to check whether the exported component was generated by mdx.Closes #368