@@ -6,6 +6,104 @@ Port of Paul Irish's [Lite YouTube Embed](https://github.com/paulirish/lite-yout
66
77![ iFrame example] ( https://react-lite-youtube-embed.s3-sa-east-1.amazonaws.com/lite.gif )
88
9+ ## Version 2.0 - BREAKNG CHANGE
10+
11+ To play nice with new frameworks like [ NextJS] ( https://nextjs.org/ ) , we now don't import the ` .css ` necessary. Instead in order to use now you have three options:
12+
13+ ### Option 1
14+
15+ Manual import our file in your React application this way:
16+
17+ ### Option 2
18+
19+ Place the necessary CSS in your Global CSS file
20+
21+ ``` css
22+ .yt-lite {
23+ background-color : #000 ;
24+ position : relative ;
25+ display : block ;
26+ contain : content ;
27+ background-position : center center ;
28+ background-size : cover ;
29+ cursor : pointer ;
30+ }
31+
32+ /* gradient */
33+ .yt-lite ::before {
34+ content : ' ' ;
35+ display : block ;
36+ position : absolute ;
37+ top : 0 ;
38+ background-image : url (data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg== );
39+ background-position : top ;
40+ background-repeat : repeat-x ;
41+ height : 60px ;
42+ padding-bottom : 50px ;
43+ width : 100% ;
44+ transition : all 0.2s cubic-bezier (0 , 0 , 0.2 , 1 );
45+ }
46+
47+ /* responsive iframe with a 16:9 aspect ratio
48+ thanks https://css-tricks.com/responsive-iframes/
49+ */
50+ .yt-lite ::after {
51+ content : " " ;
52+ display : block ;
53+ padding-bottom : calc (100% / (16 / 9 ));
54+ }
55+ .yt-lite > iframe {
56+ width : 100% ;
57+ height : 100% ;
58+ position : absolute ;
59+ top : 0 ;
60+ left : 0 ;
61+ }
62+
63+ /* play button */
64+ .yt-lite > .lty-playbtn {
65+ width : 70px ;
66+ height : 46px ;
67+ background-color : #212121 ;
68+ z-index : 1 ;
69+ opacity : 0.8 ;
70+ border-radius : 14% ; /* TODO: Consider replacing this with YT's actual svg. Eh. */
71+ transition : all 0.2s cubic-bezier (0 , 0 , 0.2 , 1 );
72+ }
73+ .yt-lite :hover > .lty-playbtn {
74+ background-color : #f00 ;
75+ opacity : 1 ;
76+ }
77+ /* play button triangle */
78+ .yt-lite > .lty-playbtn :before {
79+ content : ' ' ;
80+ border-style : solid ;
81+ border-width : 11px 0 11px 19px ;
82+ border-color : transparent transparent transparent #fff ;
83+ }
84+
85+ .yt-lite > .lty-playbtn ,
86+ .yt-lite > .lty-playbtn :before {
87+ position : absolute ;
88+ top : 50% ;
89+ left : 50% ;
90+ transform : translate3d (-50% , -50% , 0 );
91+ }
92+
93+ /* Post-click styles */
94+ .yt-lite.lyt-activated {
95+ cursor : unset ;
96+ }
97+ .yt-lite.lyt-activated ::before ,
98+ .yt-lite.lyt-activated > .lty-playbtn {
99+ opacity : 0 ;
100+ pointer-events : none ;
101+ }
102+ ```
103+ ### Option 3
104+
105+ Using your CSS-In-JS tool of choice encapsulate this component and use the css provided as a guide.
106+
9107## Installation
10108
11109Use your favorite package manager:
0 commit comments