-
Notifications
You must be signed in to change notification settings - Fork 504
feat(www): implements the new CodeBlock #6055
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
Draft
matuzalemsteles
wants to merge
22
commits into
liferay:master
Choose a base branch
from
matuzalemsteles:www-codeblock
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
…of collection to directory for the blog
Unfortunately, the sandpack is very slow and makes the page slow when there are many examples, so the benefit here is minimal. I developed our own code block using renoun tokens that add types to our examples, also using react-live for the preview that allows us to quickly render our examples without depending on remote dependencies. We still maintain the button to open the example that has a preview in codesandbox, which is a big game changer.
… documentation examples
…lector component examples
Thanks Matu! This looks like a great improvement. Would it be difficult to also make the code blocks for examples editable on the site? |
Yes, it is possible, but I believe we have lost intellisense. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Well, I refactor the CodeBlock implementation that removes the use of the sandpack and brings many user experience improvements. This implementation still keeps the button to open the example in codesandbox, which is great because it is a very important feature.
Live: https://next.clayui.com/docs/components/alert
Some highlights of this new codeblock in the documentation:
As part of the new CodeBlock I also needed to update the
renoun
dependency and I would need to refactor part of the documentation to use the new APIs. This also brought performance improvements to local testing so the pages load faster than before.This change solves some bugs such as when opening the example in codesandbox the icons now load normally and it is also now possible to add the chart examples again which will be done in another PR #5955.
CodeBlock can also support HTML code preview, which is not currently possible, but I need to make some adjustments. This helps reduce the amount of duplicated code in the documentation and makes maintenance easier, as well as making the examples more complete for markup documents.
ToDo