Add individual code examples for SelectNext #1340
Closed
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.
This PR is an attempt to improve SelectNext's documentation, and close #1331
The primary focus is to illustrate the different ways in which the component can be used by adding smaller and individual code examples in different sections of the pages, and removing the single bigger existing code example at the bottom.
This helps referencing concepts later in the docs, making sure they have already been illustrated beforehand.
Considerations
The way this has been achieved is not ideal though (and that's why I'm creating this a draft).
The
Library.Demo
component already supports displaying code snippets with syntax highlight, based on code examples that are verified and we know are correct.However, this component is limited to only render code for JSX, and not javascript, which is a problem, since in most of the
SelectNext
examples we need to show how different elements interact via hooks or external props.Because of that, I have kept the interactive examples using
Library.Demo
and usedLibrary.Code
to illustrate the usage.This has some drawbacks:
Testing
The changes can be seen by checking out this branch and going to http://localhost:4001/input-select-next