Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-aspect-ratio-fence
Advanced tools
for more information, please see: Document
npm i react-aspect-ratio-fence
AspectRatioFence (no IE support
)
Set ratio
as css custom properties, and calc() the height of elementType
's pseudo-element as placeholder. The defailt style will fit the children
node into the placeholer.
props | type | required | default | description |
---|---|---|---|---|
elementType | string | false | div | html tag name for the wrap component |
ratio | number | true | 1 | The aspect ratio of an image describes the proportional relationship between width and height |
className | string | false | undefined | Custom class name |
children | ReactNode | false | undefined | custom children node |
AspectRatioFenceLegacy
Caculate the height of innerElementType
base on the width of outerElementType
and ratio
. The defailt style will fit the children
node into the placeholer.
props | type | required | default | description |
---|---|---|---|---|
outerElementType | string | false | div | html tag name for the outer component |
innerElementType | string | false | div | html tag name for the inner component |
ratio | number | true | 1 | The aspect ratio of an image describes the proportional relationship between width and height |
className | string | false | undefined | Custom class name |
children | ReactNode | false | undefined | custom children node |
SquareFence
Set height of elementType
's pseudo-element to the value of elementType
's width. The defailt style will fit the children
node into the placeholer.
props | type | required | default | description |
---|---|---|---|---|
elementType | string | false | div | html tag name for the wrap component |
className | string | false | undefined | Custom class name |
children | ReactNode | false | undefined | custom children node |
// import from package entry point
const uc = require('react-aspect-ratio-fence')
require('react-aspect-ratio-fence/css/style.css')
<uc.AspectRatioFence {...props} />
<uc.SquareFence {...props} />
// only import specific component
const AspectRatioFence = require('react-aspect-ratio-fence/lib/components/AspectRatioFence')
require('react-aspect-ratio-fence/css/components/AspectRatioFence/style.css')
<AspectRatioFence {...props} />
// import from package entry point
import { AspectRatioFence, SquareFence } from 'react-aspect-ratio-fence'
import 'react-aspect-ratio-fence/css/style.css'
<AspectRatioFence {...props} />
<SquareFence {...props} />
// only import specific component
import AspectRatioFence from 'react-aspect-ratio-fence/es/components/AspectRatioFence'
import 'react-aspect-ratio-fence/css/components/AspectRatioFence/style.css'
<AspectRatioFence {...props} />
npm install
npm start storybook
.storybook
directory.stories
directorynpm run test
__tests__
jest
test:update
to update jest snapshot
FAQs
Set Custom Aspect Ratio to the Wrap Element(fence)
We found that react-aspect-ratio-fence 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.