- Notifications
You must be signed in to change notification settings - Fork29.8k
Add with-mdx-remote example#16613
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
17 commits Select commitHold shift + click to select a range
fa05082 Add with-mdx-remote example
danedened2892a Add note about conditional custom components
daneden4679aa0 Add clarifying comment to components object
daneden466f862 Add example React component
danedene44d1d2 Consistently use .jsx extension
daneden6c9e335 Use `as` prop for Link to dynamic routes
daneden944c596 Update readme and add next-remote-watch example
daneden919e469 Remove next.config.js
daneden3a61cb0 Update readme to use `getStaticProps` instead of `getInitialProps`
daneden2f6e129 Remove empty devDependencies
daneden2ae64ff Improve design for example
daneden0e031ac Use .js instead of .jsx
danedenbcb948c Add nicer styles and example content
daneden3d2eaaa Merge branch 'canary' into with-mdx-remote-example
daneden5e03d7f Updated readme
lfades7e80a84 Updated package.json
lfadesce8ecad Merge branch 'canary' into with-mdx-remote-example
kodiakhq[bot]File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Add nicer styles and example content
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commitbcb948c26b0fc433e4a9cb48be615473f4a4cbaa
There are no files selected for viewing
15 changes: 15 additions & 0 deletionsexamples/with-mdx-remote/components/Layout.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletionexamples/with-mdx-remote/components/TestComponent.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,16 @@ | ||
| export default function TestComponent({ name = 'world' }) { | ||
| return ( | ||
| <> | ||
| <div>Hello, {name}!</div> | ||
| <style jsx>{` | ||
| div { | ||
| background-color: #111; | ||
| border-radius: 0.5em; | ||
| color: #fff; | ||
| margin-bottom: 1.5em; | ||
| padding: 0.5em 0.75em; | ||
| } | ||
| `}</style> | ||
| </> | ||
| ) | ||
| } |
22 changes: 20 additions & 2 deletionsexamples/with-mdx-remote/pages/posts/[slug].js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletionsexamples/with-mdx-remote/posts/example-post.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| --- | ||
| title: Example Post | ||
| description: This frontmatter description will appear below the title | ||
| --- | ||
| This is an example post, with a [link](https://nextjs.org) and a React component: | ||
| <TestComponent name="next-mdx-remote" /> | ||
| The title and description are pulled from the MDX file and processed using `gray-matter`. Additionally, links are rendered using a custom component passed to `next-mdx-remote`. | ||
| Go back [home](/). |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.