Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-responsive-embed
Advanced tools
Readme
You want to embed a YouTube or other iframe
style embedded content, and you'd
like it to take up the available width, and retain it's aspect ratio.
Much like the Bootstrap responsive embed helpers of old, but for react.
npm install --save react-responsive-embed
Then in your app import ResponsiveEmbed
and in JSX flavour you might do:
<ResponsiveEmbed src='https://www.youtube.com/embed/2yqz9zgoC-U' allowfullscreen />
Which'd give you an iframe
element pointing at the src
and any other props.
It's wrapped in a div
with just the right amount of padding-bottom
to
preserve a 16:9 aspect ratio like so:
<div style="position:relative;height:0;overflow:hidden;max-width:100%;padding-bottom:56.25%;">
<iframe src="https://www.youtube.com/embed/2yqz9zgoC-U"
style="position:absolute;top:0;left:0;width:100%;height:100%;"
frameborder="0"
allowfullscreen></iframe>
</div>
Pass in a ratio
prop to pick a different one. Any ratio will do:
<ResponsiveEmbed src='https://www.youtube.com/embed/2yqz9zgoC-U' ratio='4:3' />
frameborder="0"
is applied by default.
This module is just a function. It's been babelified so it'll work with whatever your set up is. Use browserify or webpack or any other npm module consuming bundle whizzbang; ResponsiveEmbed don't mind.
A (╯°□°)╯︵TABLEFLIP side project.
FAQs
Embed iframes responsively
The npm package react-responsive-embed receives a total of 2,542 weekly downloads. As such, react-responsive-embed popularity was classified as popular.
We found that react-responsive-embed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.