-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
baa32a2
Add generic Codepen Snippet component
ErickPetru 254492c
Update "/examples" with common-codepen-snippet
ErickPetru a05cecf
Update "/guide" with common-codepen-snippet
ErickPetru b802bd3
Update "/cookbook" with common-codepen-snippet
ErickPetru 531d110
Put TODO to warn that the wrong Pen is being shown
ErickPetru e8a1643
Changes after @NataliaTepluhina and @skirtles-code reviews
ErickPetru 2b8ab23
Props to recover editable and preview behavior
ErickPetru de0bcd7
Set custom pen author with props
ErickPetru 359143e
Update wrong pen title
ErickPetru a4062c5
Merge branch 'master' of https://github.com/vuejs/docs-next
ErickPetru c7f9719
Use CodepenSnippet component
ErickPetru 53837f4
Merge branch 'master' of https://github.com/vuejs/docs-next
ErickPetru 52fb07f
fix: small changes after @skirtles-code review
ErickPetru c1cc92e
Merge branch 'master' of https://github.com/vuejs/docs-next
ErickPetru fc687f0
Update last embed to use CodepenSnippet component
ErickPetru 269c9c4
Use CodepenSnippet also in .reactivecontent divs
ErickPetru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<template> | ||
<p | ||
class="codepen" | ||
:data-theme-id="theme" | ||
:data-preview="preview || null" | ||
:data-editable="editable || null" | ||
:data-height="height" | ||
:data-default-tab="tab" | ||
:data-user="user" | ||
:data-slug-hash="slug" | ||
:data-pen-title="title" | ||
:data-embed-version="version" | ||
:style="`height: ${height}px`"> | ||
<span>See the Pen <a :href="href">{{ title }}</a> | ||
by {{ name || user }} (<a :href="`https://codepen.io/${user}`">@{{user}}</a>) | ||
on <a href="https://codepen.io">CodePen</a>.</span> | ||
</p> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
title: { | ||
type: String, | ||
default: null, | ||
required: true, | ||
}, | ||
|
||
slug: { | ||
type: String, | ||
default: null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
required: true, | ||
}, | ||
|
||
tab: { | ||
type: String, | ||
default: 'result', | ||
}, | ||
|
||
team: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
|
||
user: { | ||
type: String, | ||
default: 'Vue', | ||
}, | ||
|
||
name: { | ||
type: String, | ||
default: null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
}, | ||
|
||
height: { | ||
type: Number, | ||
default: 300, | ||
}, | ||
|
||
theme: { | ||
type: String, | ||
default: '39028', | ||
}, | ||
|
||
preview: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
|
||
editable: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
|
||
version: { | ||
type: String, | ||
default: null, | ||
} | ||
}, | ||
mounted() { | ||
const codepenScript = document.createElement('script') | ||
codepenScript.setAttribute('src', 'https://static.codepen.io/assets/embed/ei.js') | ||
codepenScript.async = true | ||
this.$el.appendChild(codepenScript) | ||
}, | ||
computed: { | ||
href() { | ||
return `https://codepen.io/${this.team ? 'team' : ''}${this.user}/pen/${this.slug}` | ||
} | ||
}, | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
.codepen { | ||
box-sizing: border-box; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border: 2px solid; | ||
margin: 1em 0; | ||
padding: 1em; | ||
} | ||
</style> |
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
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
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,8 +1,3 @@ | ||
# Elastic Header Example | ||
|
||
<p class="codepen" data-height="474" data-theme-id="39028" data-default-tab="js,result" data-user="immarina" data-slug-hash="ZEWGmar" style="height: 474px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="Vue 3 Markdown Editor"> | ||
<span>See the Pen <a href="https://codepen.io/immarina/pen/ZEWGmar"> | ||
Vue 3 Markdown Editor</a> by Vue (<a href="https://codepen.io/immarina">@immarina</a>) | ||
on <a href="https://codepen.io">CodePen</a>.</span> | ||
</p> | ||
<script async src="https://static.codepen.io/assets/embed/ei.js"></script> | ||
<common-codepen-snippet title="Vue 3 Elastic Draggable Header Example" slug="ZEWGmar" :height="474" tab="js,result" :team="false" user="immarina" name="Vue" :preview="false" :editable="false" /> |
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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
orrequired
. Otherwise, they basically cancel each other out.In this case, it should most likely be
required
with nodefault
property.