-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat: created generic Codepen Snippet component #548
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
Conversation
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.
@ErickPetru I like the idea! I've left one nitpick to codepen component but overall it looks good to me 👍🏻
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.
A few suggestions from me.
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.
Thanks for the work on this @ErickPetru! Your refactoring has shown us that there's some clean up that needs to do in terms of standardizing some things so it's easier to turn into a component. I think we should probably hold on this until those changes are made so you can update the PR.
Hi @bencodezen, my intention with this PR was not to change current behavior. I really forgot some possible adaptations at the first pass, but after @skirtles-code review, I've already sent more commits with everything (I hope) in the same way it was before. I believe it's secure to merge after the next review phase. Indeed, even future standardization on the embeds will be a lot easier with the new component. Also, feel free to ask for more changes if you want. |
@ErickPetru Currently there are conflicts with Given what @bencodezen said, I'm unclear whether more conflicts are coming or if this is now good to proceed. I'm happy to do another review but I'd rather wait for confirmation that there aren't more conflicts coming first. |
@skirtles-code and @bencodezen I saw the recent changes on |
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.
Some more suggestions from me.
I've not made any subjective decisions about whether things matter, I've just reported anything that seems to have changed from what was there previously.
I agree that this component should make it easier to remove the current inconsistencies.
Sorry for the delay, hard job weeks here currently. |
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.
There's a new CodePen example at the bottom of transitions-enterleave.md
.
Usually I'd suggest migrating it post-merge but in this case it seems that the component can't co-exist with non-component CodePens. That new example gets a thick, black border around it as a result.
I did a bit of debugging and it seems to be a consequence of how SSR and the CodePen script interact with each other. So long as everything is using the component it should be fine.
As SSR is involved you can only see the problem by going directly to the right page:
If you navigate there via another page it all behaves.
Incredible was your catch about SSR with Codepen embeds without the new component, @skirtles-code! So as you suggested, I just updated Then I just realized that the project could have direct Please take a look and talk to me if something more is needed. |
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.
Thanks for your hard work on this @ErickPetru!
props: { | ||
title: { | ||
type: String, | ||
default: null, |
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.
When defining props, it's best to choose either default
or required
. Otherwise, they basically cancel each other out.
In this case, it should most likely be required
with no default
property.
|
||
slug: { | ||
type: String, | ||
default: null, |
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.
Same as above
|
||
name: { | ||
type: String, | ||
default: null, |
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.
If the type should be String, then we should set the default to ''
instead to be consistent.
Description of Problem
Right now, more than 20 files along the documentation have Codepen embeds with small changes on each one, like this:
This large block of copied-and-pasted content takes up a lot of space in each place and is hard to maintain.
Also, as a documentation translation maintainer, I feel how it's annoying to keep all embeds translated in the same way when we have different collaborators translating different files.
And last but not least, using Single File Components inside Markdown with VuePress is so cool! Why not take advantage of this tool one more time to improve this scenario?
Proposed Solution
A generic Codepen Snippet component, with props covering all different situations where Codepen embeds are use a little different across the documentation, but with good defaults that cover the majority of the use cases, to keep the usage simple.
Additional Information
I took the liberty of changing all the Codepen embeds currently used in the documentation to use the new component, in order to test its effectiveness (and also to facilitate the work of the core team). I am available to make any additional adjustments to it if necessary.