-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #359 from tjallingt/canary
chore: release
- Loading branch information
Showing
14 changed files
with
465 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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 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 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,35 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo |
This file contains 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,17 @@ | ||
# react-youtube example ssr | ||
|
||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. |
This file contains 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,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains 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,6 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
}; | ||
|
||
module.exports = nextConfig; |
This file contains 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,22 @@ | ||
{ | ||
"name": "react-youtube-example-ssr", | ||
"version": "1.0.0", | ||
"description": "react-youtube example ssr starter project", | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start" | ||
}, | ||
"dependencies": { | ||
"next": "12.1.6", | ||
"react": "18.1.0", | ||
"react-dom": "18.1.0", | ||
"react-youtube": "1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "17.0.35", | ||
"@types/react": "18.0.9", | ||
"@types/react-dom": "18.0.5", | ||
"typescript": "4.6.3" | ||
} | ||
} |
This file contains 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,8 @@ | ||
import '../styles/globals.css'; | ||
import type { AppProps } from 'next/app'; | ||
|
||
function MyApp({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} />; | ||
} | ||
|
||
export default MyApp; |
This file contains 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,67 @@ | ||
import { useState } from 'react'; | ||
import YouTube, { YouTubePlayer } from 'react-youtube'; | ||
import type { NextPage } from 'next'; | ||
import Head from 'next/head'; | ||
|
||
const VIDEOS = ['XxVg_s8xAms', '-DX3vJiqxm4']; | ||
|
||
const Home: NextPage = () => { | ||
const [player, setPlayer] = useState<YouTubePlayer>(); | ||
const [videoIndex, setVideoIndex] = useState(0); | ||
const [width, setWidth] = useState(600); | ||
const [hidden, setHidden] = useState(false); | ||
const [autoplay, setAutoplay] = useState(false); | ||
|
||
return ( | ||
<div id="app"> | ||
<Head> | ||
<title>react-youtube example ssr</title> | ||
</Head> | ||
<div style={{ display: 'flex', marginBottom: '1em' }}> | ||
<button type="button" onClick={() => player?.seekTo(120, true)}> | ||
Seek to 2 minutes | ||
</button> | ||
<button type="button" onClick={() => setVideoIndex((videoIndex + 1) % VIDEOS.length)}> | ||
Change video | ||
</button> | ||
<label> | ||
<input | ||
type="range" | ||
min="300" | ||
max="1080" | ||
value={width} | ||
onChange={(event) => setWidth(event.currentTarget.valueAsNumber)} | ||
/> | ||
Width ({width}px) | ||
</label> | ||
<button type="button" onClick={() => setHidden(!hidden)}> | ||
{hidden ? 'Show' : 'Hide'} | ||
</button> | ||
<label> | ||
<input type="checkbox" checked={autoplay} onChange={(event) => setAutoplay(event.currentTarget.checked)} /> | ||
Autoplaying | ||
</label> | ||
</div> | ||
|
||
{hidden ? ( | ||
'mysterious' | ||
) : ( | ||
// @ts-ignore | ||
<YouTube | ||
videoId={VIDEOS[videoIndex]} | ||
opts={{ | ||
width, | ||
height: width * (9 / 16), | ||
playerVars: { | ||
autoplay: autoplay ? 1 : 0, | ||
}, | ||
}} | ||
className="container" | ||
onReady={(event) => setPlayer(event.target)} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Home; |
Binary file not shown.
This file contains 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,6 @@ | ||
#app { | ||
font-family: sans-serif; | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
} |
This file contains 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,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains 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.