Skip to content

Commit

Permalink
use react video player
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcarpenter committed Nov 29, 2021
1 parent 731851c commit 07c42d2
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 8 deletions.
16 changes: 10 additions & 6 deletions website/components/io-video-callout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import Image from 'next/image'
import ReactPlayer from 'react-player'
import VisuallyHidden from '@reach/visually-hidden'
import IoDialog from 'components/io-dialog'
import PlayIcon from './play-icon'
Expand Down Expand Up @@ -61,15 +62,18 @@ export default function IoVideoCallout({
onDismiss={hideVideo}
label={`${heading} video}`}
>
<h2 className={s.videoHeading}>{heading}</h2>
<div className={s.video}>
<iframe
<ReactPlayer
url={`https://www.youtube.com/embed/${youtubeId}`}
playing={true}
width="560"
height="315"
src={`https://www.youtube.com/embed/${youtubeId}`}
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
frameBorder="0"
></iframe>
style={{
maxWidth: '100%',
}}
controls={true}
/>
</div>
</IoDialog>
</>
Expand Down
7 changes: 7 additions & 0 deletions website/components/io-video-callout/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@
color: var(--gray-3);
}

.videoHeading {
margin-top: 0;
margin-bottom: 32px;
padding-right: 100px;
composes: g-type-display-4 from global;
}

.video {
position: relative;
background-color: var(--gray-2);
Expand Down
75 changes: 74 additions & 1 deletion website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"next-remote-watch": "1.0.0",
"react": "^17.0.2",
"react-datocms": "^1.6.6",
"react-dom": "^17.0.2"
"react-dom": "^17.0.2",
"react-player": "^2.9.0"
},
"devDependencies": {
"@hashicorp/platform-cli": "^1.2.0",
Expand Down

0 comments on commit 07c42d2

Please sign in to comment.