Socket
Socket
Sign inDemoInstall

react-aspect-ratio-fence

Package Overview
Dependencies
7
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-aspect-ratio-fence

Set Custom Aspect Ratio to the Wrap Element(fence)


Version published
Maintainers
1
Install size
33.0 kB
Created

Changelog

Source

<small>1.8.5 (2021-02-21)</small>

  • chore: add branch master (4854b9e)
  • chore: bump semantic-release (20943d1)
  • chore(deps-dev): bump codecov from 3.5.0 to 3.7.1 (a7bbef7)
  • chore(deps-dev): bump semantic-release from 15.13.26 to 17.2.3 (70f0679)
  • chore(deps-dev): bump semantic-release from 15.13.26 to 17.2.3 (5a8749d)
  • chore(deps): bump acorn from 5.7.3 to 5.7.4 (e112786)
  • chore(deps): bump elliptic from 6.5.0 to 6.5.3 (15f247d)
  • chore(deps): bump handlebars from 4.4.3 to 4.7.6 (c5307cb)
  • chore(deps): bump https-proxy-agent from 2.2.2 to 2.2.4 (9fc6e24)
  • chore(deps): bump ini from 1.3.5 to 1.3.7 (394e493)
  • chore(deps): bump markdown-to-jsx from 6.10.2 to 6.11.4 (cd0dd2d)
  • chore(deps): bump nested-object-assign from 1.0.3 to 1.0.4 (c5c27f0)
  • chore(deps): bump websocket-extensions from 0.1.3 to 0.1.4 (c8a7c9a)
  • Merge pull request #10 from danhuang1202/dependabot/npm_and_yarn/codecov-3.7.1 (f62fde7), closes #10
  • Merge pull request #11 from danhuang1202/dependabot/npm_and_yarn/elliptic-6.5.3 (c02985c), closes #11
  • Merge pull request #12 from danhuang1202/dependabot/npm_and_yarn/markdown-to-jsx-6.11.4 (b11f284), closes #12
  • Merge pull request #13 from danhuang1202/dependabot/npm_and_yarn/handlebars-4.7.6 (2b046b3), closes #13
  • Merge pull request #14 from danhuang1202/dependabot/npm_and_yarn/semantic-release-17.2.3 (d86636b), closes #14
  • Merge pull request #15 from danhuang1202/dependabot/npm_and_yarn/ini-1.3.7 (2982644), closes #15
  • Merge pull request #16 from danhuang1202/dependabot/npm_and_yarn/nested-object-assign-1.0.4 (4a5ac62), closes #16
  • Merge pull request #17 from danhuang1202/revert-14-dependabot/npm_and_yarn/semantic-release-17.2.3 (d0e0979), closes #17
  • Merge pull request #18 from danhuang1202/dependabot/npm_and_yarn/semantic-release-17.2.3 (e95daf5), closes #18
  • Merge pull request #6 from danhuang1202/dependabot/npm_and_yarn/acorn-5.7.4 (076ab9b), closes #6
  • Merge pull request #7 from danhuang1202/dependabot/npm_and_yarn/https-proxy-agent-2.2.4 (fbe343f), closes #7
  • Merge pull request #8 from danhuang1202/dependabot/npm_and_yarn/websocket-extensions-0.1.4 (8d07dde), closes #8
  • Revert "chore(deps-dev): bump semantic-release from 15.13.26 to 17.2.3" (04db44f)
  • fix: add react@17 to peerDependencies (8b2ce2d)

Readme

Source

react-aspect-ratio-fence

Build Status codecov NPM version

for more information, please see: Document

Installation

npm i react-aspect-ratio-fence

Components

  • 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.

    propstyperequireddefaultdescription
    elementTypestringfalsedivhtml tag name for the wrap component
    rationumbertrue1The aspect ratio of an image describes the proportional relationship between width and height
    classNamestringfalseundefinedCustom class name
    childrenReactNodefalseundefinedcustom 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.

    propstyperequireddefaultdescription
    outerElementTypestringfalsedivhtml tag name for the outer component
    innerElementTypestringfalsedivhtml tag name for the inner component
    rationumbertrue1The aspect ratio of an image describes the proportional relationship between width and height
    classNamestringfalseundefinedCustom class name
    childrenReactNodefalseundefinedcustom 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.

    propstyperequireddefaultdescription
    elementTypestringfalsedivhtml tag name for the wrap component
    classNamestringfalseundefinedCustom class name
    childrenReactNodefalseundefinedcustom children node

Way to Ride

  • Common jS
// 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} />
  • ESM
// 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} />

Development by storybook

npm install
npm start storybook
  • configuration files list in .storybook directory
  • story files list in .stories directory

Test with Jest and Puppeteer

npm run test
  • __tests__
    • unit test running by jest
    • use test:update to update jest snapshot

Keywords

FAQs

Last updated on 21 Feb 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc