Skip to content

Commit ecc618c

Browse files
authored
Some upgrades and a new feature
- πŸ”– upgrade: several upgrades in packages to latest version - Thanks @theodorusclarence for the new feature for aspect-ratio
2 parents 1942c6c + 18f1a56 commit ecc618c

File tree

14 files changed

+4843
-2748
lines changed

14 files changed

+4843
-2748
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div align="center">
2-
2+
33
<h1>πŸ“Ί React Lite YouTube Embed</h1>
44
<blockquote>A private by default, faster and cleaner YouTube embed component for React applications</blockquote>
5-
5+
66
[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)
7-
7+
88
[![Version](https://img.shields.io/npm/v/react-lite-youtube-embed?label=latest%20version)](https://www.npmjs.com/package/react-lite-youtube-embed)&nbsp; &nbsp;[![License](https://badgen.net/github/license/ibrahimcesar/react-lite-youtube-embed)](./LICENSE)&nbsp; &nbsp;![GitHub issues by-label](https://img.shields.io/github/issues/ibrahimcesar/react-lite-youtube-embed/bug)
99

1010
<p>Developed in πŸ‡§πŸ‡· <span role="img" aria-label="Flag for Brazil">Brazil</p>
@@ -93,7 +93,7 @@ const App = () => (
9393

9494
## ⚠️ After version 1.0.0 - BREAKING CHANGES ⚠️
9595

96-
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:
96+
To play nice with new frameworks like [NextJS](https://nextjs.org/), we now don't import the `.css` necessary. Since version `2.0.9` you can pass custom aspect-ratio props, so be aware of any changes needed in the CSS options. Instead in order to use now you have three options:
9797

9898
### Option 1
9999

@@ -188,7 +188,7 @@ Place the necessary CSS in your Global CSS file method of preference
188188

189189
For example, for NextJS:
190190

191-
```jsx
191+
```jsx
192192
<style jsx global>{`
193193
html,
194194
body {
@@ -201,10 +201,9 @@ For example, for NextJS:
201201
202202
* {
203203
box-sizing: border-box;
204-
}
205-
204+
206205
// CSS above
207-
206+
208207
`}</style>
209208

210209
```
@@ -221,7 +220,7 @@ Not work on every framework but you can import the css directly, check what work
221220

222221
<details>
223222
<summary>Show me the code!</summary>
224-
223+
225224
```ts
226225
import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css';
227226
```
@@ -245,6 +244,8 @@ Only two props are required to work: `id` from the YouTube you want to render an
245244
| activeClass | string | Pass the string class for the active state |
246245
| adNetwork | boolean | Default: `false` To preconnect or not to doubleclick addresses called by YouTube iframe (the adnetwork from Google) |
247246
| announce | string | Default: `Watch`. This will be passed to the button in order to be announced to the final user as in `Clickable Watch, ${title}, button` , customize to match your own language #a11y #i18n |
247+
| aspectHeight | number | Default: `9`. Use this optional prop if you want a custom aspect-ratio. Please be aware of aspect height and width relation and also any custom CSS you are using. |
248+
| aspectWidth | number | Default: `16`. Use this optional prop if you want a custom aspect-ratio. Please be aware of aspect height and width relation and also any custom CSS you are using. |
248249
| cookie | boolean | Default: `false` Connect to YouTube via the Privacy-Enhanced Mode using https://www.youtube-nocookie.com You should opt-in to allow cookies|
249250
| iFrameClass | string | Pass the string class for the own iFrame |
250251
| noCookie | boolean | `Deprecated` Default `false` _use option **cookie** to opt-in_|
@@ -257,22 +258,24 @@ Only two props are required to work: `id` from the YouTube you want to render an
257258
| onIframeAdded | function | Callback that will be called when iframe is added |
258259

259260

260-
### TO DO:
261-
- Add tests
261+
## πŸ™‡β€β™‚οΈ Thanks
262+
263+
- Paul Irish ([paulirish](https://github.com/paulirish)) for [Lite YouTube Embed](https://github.com/paulirish/lite-youtube-embed)
264+
- Addy Osmani ([addyosmani](https://github.com/addyosmani)) for the Adaptive Loading ideas
265+
- [All contributors](https://github.com/ibrahimcesar/react-lite-youtube-embed/graphs/contributors)
266+
267+
### πŸ“ Read more
268+
- [Why I made my open source React component private by default](https://ibrahimcesar.cloud/blog/why-i-made-my-open-source-react-component-private-by-default/)
262269

263-
## Thanks
264270

265-
Paul Irish ([paulirish](https://github.com/paulirish)) for [Lite YouTube Embed](https://github.com/paulirish/lite-youtube-embed)
266-
AcauΓ£ Sperl de Faria ([acaua](https://github.com/acaua)) for code review
267-
Addy Osmani ([addyosmani](https://github.com/addyosmani)) for the Adaptive Loading ideas
271+
### 🈺 TODO:
268272

269-
## See Also
273+
- [ ] Add tests
270274

271-
[React Quicklink](https://www.npmjs.com/package/react-quicklink): Faster subsequent page-loads by prefetching in-viewport links during idle time for __React__
272275

273276
## MIT License
274277

275-
Copyright (c) 2021 Ibrahim Cesar
278+
Copyright (c) 2021 [Ibrahim Cesar](https://ibrahimcesar.cloud)
276279

277280
Permission is hereby granted, free of charge, to any person obtaining a copy
278281
of this software and associated documentation files (the "Software"), to deal

β€Ždemo/package-lock.jsonβ€Ž

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždemo/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"prismjs": "^1.24.0",
1515
"react": "17.0.2",
1616
"react-dom": "17.0.2",
17-
"react-lite-youtube-embed": "2.0.6"
17+
"react-lite-youtube-embed": "2.0.9-beta"
1818
}
1919
}

β€Ždemo/pages/index.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default function Home() {
142142
target="_blank"
143143
rel="noopener noreferrer"
144144
>
145-
Demo for <span role="img" aria-label="TV" style={{marginLeft: "5px", marginRight: "5px"}}> πŸ“Ί </span> React Lite YouTube Embed
145+
Demo for <span role="img" aria-label="TV" style={{marginLeft: "5px", marginRight: "5px"}}>β€β€β€Ž β€Žβ€β€β€Ž πŸ“Ί β€β€β€Ž β€Žβ€β€β€Ž </span> React Lite YouTube Embed
146146

147147
</a>
148148
</footer>

β€Ždist/LiteYouTubeEmbed.cssβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždist/index.d.tsβ€Ž

Lines changed: 18 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždist/index.es.jsxβ€Ž

Lines changed: 34 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždist/index.es.jsx.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždist/index.jsxβ€Ž

Lines changed: 50 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)