File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import GeneralObserver from ' ./general-observer.svelte'
3+
4+ export let width: string = ' 100'
5+ export let height: string = ' 500'
6+ export let codePenId: string = ' '
7+ export let tabs:
8+ | string []
9+ | ' js'
10+ | ' css'
11+ | ' scss'
12+ | ' less'
13+ | ' result' = ' result'
14+ export let clickToLoad: boolean = true
15+ export let editable: boolean = true
16+ export let theme: string | ' light' | ' dark' | ' default' = ' default'
17+
18+ const baseUrl = ` https://codepen.io/team/codepen/embed `
19+ const src = ` ${baseUrl }/${
20+ clickToLoad ? ' /preview' : ' '
21+ }/${codePenId }/?height=${height }&theme-id=${theme }&default-tab=${tabs }&editable=${editable } `
22+ </script >
23+
24+ <GeneralObserver {height } {width }>
25+ <iframe
26+ {height }
27+ class =" code-pen-sveltekit-embed"
28+ title ={` codepen-${codePenId } ` }
29+ {src }
30+ frameborder =" no"
31+ allowfullscreen
32+ style ={`
33+ width: 100%;
34+ ` }
35+ />
36+ </GeneralObserver >
Original file line number Diff line number Diff line change 11export { default as AnchorFm } from './components/anchor-fm.svelte'
22export { default as Buzzsprout } from './components/buzzsprout.svelte'
3+ export { default as CodePen } from './components/code-pen.svelte'
34export { default as Deezer } from './components/deezer.svelte'
45export { default as GeneralObserver } from './components/general-observer.svelte'
56export { default as GenericEmbed } from './components/generic-embed.svelte'
Original file line number Diff line number Diff line change 22 import {
33 AnchorFm ,
44 Buzzsprout ,
5+ CodePen ,
56 Deezer ,
67 GenericEmbed ,
78 SimpleCast ,
@@ -81,6 +82,39 @@ Output:
8182 buzzsproutId="190346/9866589-185-scott-spence-from-vba-analyst-to-webdev"
8283/>
8384
85+ ## CodePen
86+
87+ Props:
88+
89+ ``` ts
90+ width : string = ' 100'
91+ height : string = ' 500'
92+ codePenId : string = ' '
93+ tabs :
94+ | string []
95+ | ' js'
96+ | ' css'
97+ | ' scss'
98+ | ' less'
99+ | ' result' = ' result'
100+ clickToLoad : boolean = true
101+ editable : boolean = true
102+ theme : string | ' light' | ' dark' | ' default' = ' default'
103+ ```
104+
105+ Usage:
106+
107+ For a CodePen URL like this: https://codepen.io/spences10/pen/WNMvXpa
108+ take the ` codePenId ` this ` WNMvXpa ` and add it to the component.
109+
110+ ``` html
111+ <CodePen codePenId =" WNMvXpa" />
112+ ```
113+
114+ Output:
115+
116+ <CodePen codePenId =" WNMvXpa " />
117+
84118## Deezer
85119
86120Props:
You can’t perform that action at this time.
0 commit comments