Skip to content

Commit

Permalink
💄 Support Spotify embed
Browse files Browse the repository at this point in the history
  • Loading branch information
Luuk de Vlieger committed Sep 29, 2020
1 parent 03be009 commit fc7f394
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ const parser = {
(node) => node.name === 'iframe'
)[0]

const isVideo = node.attribs?.class?.includes('is-provider-vimeo') || node.attribs?.class?.includes('is-provider-youtube')

return (
<figure className="mb-6">
<div className="relative pb-9/16">
<div className={clsx("relative", isVideo && 'pb-9/16')}>
<iframe
src={iframe.attribs.src}
frameBorder={0}
allow="fullscreen"
className="h-full w-full top-0 left-0 absolute"
className={clsx(isVideo && 'h-full w-full top-0 left-0 absolute')}
frameBorder={0}
height={iframe.attribs.height}
loading="lazy"
src={iframe.attribs.src}
width={iframe.attribs.width}
/>
</div>

Expand Down

0 comments on commit fc7f394

Please sign in to comment.