Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1bcdd3

Browse files
committed
Change the api of embeds
1 parent e2c5c0f commit e1bcdd3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/components/Markdown.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import React from 'react'
33
import { A, Pre } from '@/components'
44
import { CodePen, Gist, Tweet, YouTube, CodeSandbox } from 'mdx-embed'
55

6-
function Repl({ replLink }: { replLink: string }) {
6+
function Repl({ id }: { id: string }) {
77
return (
88
<>
99
<iframe
10-
title={`repl-${replLink}`}
10+
title={`repl-${id}`}
1111
height="400px"
1212
width="100%"
13-
src={`https://repl.it/${replLink}?lite=true`}
13+
src={`https://repl.it/${id}?lite=true`}
1414
scrolling="no"
1515
frameBorder="no"
1616
allowFullScreen={true}
@@ -20,14 +20,14 @@ function Repl({ replLink }: { replLink: string }) {
2020
)
2121
}
2222

23-
function Glitch({ glitchId }: { glitchId: string }) {
23+
function Glitch({ id }: { id: string }) {
2424
return (
2525
<div
2626
className="glitch-embed-wrap"
2727
style={{ height: '420px', width: '100%' }}
2828
>
2929
<iframe
30-
src={`https://glitch.com/embed/#!/embed/${glitchId}`}
30+
src={`https://glitch.com/embed/#!/embed/${id}`}
3131
title="probable-stellar-gull on Glitch"
3232
allow="geolocation; microphone; camera; midi; vr; encrypted-media"
3333
style={{ height: '100%', width: '100%', border: 0 }}
@@ -56,19 +56,21 @@ export default function Markdown(props: {
5656
component: Pre,
5757
},
5858
CodePen: {
59-
component: CodePen,
59+
component: ({ id }: { id: string }) => <CodePen codePenId={id} />,
6060
},
6161
Gist: {
62-
component: Gist,
62+
component: ({ id }: { id: string }) => <Gist gistLink={id} />,
6363
},
6464
Tweet: {
65-
component: Tweet,
65+
component: ({ id }: { id: string }) => <Tweet tweetLink={id} />,
6666
},
6767
YouTube: {
68-
component: YouTube,
68+
component: ({ id }: { id: string }) => <YouTube youTubeId={id} />,
6969
},
7070
CodeSandbox: {
71-
component: CodeSandbox,
71+
component: ({ id }: { id: string }) => (
72+
<CodeSandbox codeSandboxId={id} />
73+
),
7274
},
7375
Repl: {
7476
component: Repl,

0 commit comments

Comments
 (0)