55 * LICENSE file in the root directory of this source tree.
66 */
77
8- import React from 'react' ;
8+ import { useState } from 'react' ;
99
1010import Section from '../Section' ;
1111import SectionTitle from '../SectionTitle' ;
1212
1313import styles from './styles.module.css' ;
1414
1515function Watch ( ) {
16+ const [ playingId , setPlayingId ] = useState < string | null > ( null ) ;
17+
1618 return (
1719 < Section >
1820 < SectionTitle
@@ -34,29 +36,61 @@ function Watch() {
3436 }
3537 />
3638 < div className = { styles . videos } >
37- < div className = { styles . videoContainer } >
38- < iframe
39- src = "https://www.youtube.com/embed/NCAY0HIfrwc"
40- title = "Mobile Innovation with React Native, ComponentKit, and Litho"
41- frameBorder = "0"
42- allow = "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
43- allowFullScreen
44- className = { styles . video }
45- />
39+ < div
40+ role = "button"
41+ aria-label = "Play: FB 2019: Mobile innovation with React Native"
42+ className = { [
43+ styles . videoContainer ,
44+ playingId === 'fb2019'
45+ ? styles . videoContainerPlaying
46+ : styles . videoContainerHover ,
47+ ] . join ( ' ' ) }
48+ onClick = { ( ) => setPlayingId ( 'fb2019' ) } >
49+ { playingId === 'fb2019' ? (
50+ < iframe
51+ src = "https://www.youtube.com/embed/NCAY0HIfrwc?autoplay=1"
52+ title = "Mobile Innovation with React Native, ComponentKit, and Litho"
53+ allow = "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
54+ allowFullScreen
55+ className = { styles . video }
56+ />
57+ ) : (
58+ < img
59+ src = "https://img.youtube.com/vi/NCAY0HIfrwc/maxresdefault.jpg"
60+ alt = "Mobile Innovation with React Native, ComponentKit, and Litho"
61+ className = { styles . video }
62+ />
63+ ) }
4664 < div className = { styles . videoInfo } >
4765 < h4 > FB 2019: Mobile innovation with React Native</ h4 >
4866 < p > 45:29</ p >
4967 </ div >
5068 </ div >
51- < div className = { styles . videoContainer } >
52- < iframe
53- src = "https://www.youtube.com/embed/wUDeLT6WXnQ"
54- title = "Explain Like I'm 5: React Native"
55- frameBorder = "0"
56- allow = "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
57- allowFullScreen
58- className = { styles . video }
59- />
69+ < div
70+ role = "button"
71+ aria-label = "Play: Why React Native?"
72+ className = { [
73+ styles . videoContainer ,
74+ playingId === 'why'
75+ ? styles . videoContainerPlaying
76+ : styles . videoContainerHover ,
77+ ] . join ( ' ' ) }
78+ onClick = { ( ) => setPlayingId ( 'why' ) } >
79+ { playingId === 'why' ? (
80+ < iframe
81+ src = "https://www.youtube.com/embed/wUDeLT6WXnQ?autoplay=1"
82+ title = "Explain Like I'm 5: React Native"
83+ allow = "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
84+ allowFullScreen
85+ className = { styles . video }
86+ />
87+ ) : (
88+ < img
89+ src = "https://img.youtube.com/vi/wUDeLT6WXnQ/maxresdefault.jpg"
90+ alt = "Explain Like I'm 5: React Native"
91+ className = { styles . video }
92+ />
93+ ) }
6094 < div className = { styles . videoInfo } >
6195 < h4 > Why React Native?</ h4 >
6296 < p > 1:42</ p >
0 commit comments