GithubHelp home page GithubHelp logo

roderickhsiao / react-aspect-ratio Goto Github PK

View Code? Open in Web Editor NEW
101.0 101.0 7.0 5.24 MB

Preserve space for your element to prevent browser reflow (layout shift)

Home Page: https://roderickhsiao.github.io/react-aspect-ratio/

License: MIT License

JavaScript 18.99% Shell 9.15% CSS 29.17% HTML 0.92% TypeScript 41.76%
aspect-ratio browser-reflow css layout layout-shift react responsive ui-components

react-aspect-ratio's Introduction

Hey πŸ‘‹

Hi, Roderick here. I'm a software architect based in San Francisco Bay Area.

Drop me a message if you want to discuss interesting web ideas, questions, or potentially fun project to work together :)

Open for tech talks invitations, project architecture consulting (web performance, large scale web app, team mentoring and more). Book your free discussion session with me at Calendly.

About

  • πŸ™β€β™‚οΈ He/Him/His
  • 🐢 Dog Dad
  • πŸ‘¨β€πŸ’» Frontend Engineer
  • πŸ‡ΉπŸ‡Ό πŸ‡ΊπŸ‡Έ
  • Website

react-aspect-ratio's People

Contributors

asurare avatar chrissantamaria avatar dependabot[bot] avatar greenkeeper[bot] avatar roderickhsiao avatar tinder-rhsiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-aspect-ratio's Issues

An in-range update of react is breaking the build 🚨

There have been updates to the react monorepo:

    • The devDependency react was updated from 16.8.6 to 16.9.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the react group definition.

react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for 16.9.0 (August 8, 2019)

React

  • Add <React.Profiler> API for gathering performance measurements programmatically. (@bvaughn in #15172)
  • Remove unstable_ConcurrentMode in favor of unstable_createRoot. (@acdlite in #15532)

React DOM

React DOM Server

  • Fix incorrect output for camelCase custom CSS property names. (@bedakb in #16167)

React Test Utilities and Test Renderer

Artifacts

β€’ react: https://unpkg.com/[email protected]/umd/
β€’ react-art: https://unpkg.com/[email protected]/umd/
β€’ react-dom: https://unpkg.com/[email protected]/umd/
β€’ react-is: https://unpkg.com/[email protected]/umd/
β€’ react-test-renderer: https://unpkg.com/[email protected]/umd/
β€’ scheduler: https://unpkg.com/[email protected]/umd/

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of storybook is breaking the build 🚨

There have been updates to the storybook monorepo:

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the storybook group definition.

storybook is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v5.3.14

Bug Fixes

  • Centered: remove typesVersions attribute (#9907)
  • Props: Fix typescript unspecified default value (#9873)
  • Core: Use telejson for websockets channel (#9867)
  • Storyshots: Fix support for jsx/tsx config files (#9834)
  • MDX: Fix custom classes getting stripped (#8897)
  • Typescript: Add downlevel dts for 3.5 (#9847)
Commits

The new version differs by 41 commits.

  • 91d9c0c v5.3.14
  • 01ab760 Update peer dependencies to 5.3.14
  • bb222fa Prettier changelog
  • 1ddadfd 5.3.14 changelog
  • 5d2c9bf Merge pull request #9907 from storybookjs/fix-ts-export-for-addon-centered
  • 0395223 Merge pull request #9873 from storybookjs/9827-ts-default-values
  • 7ab4626 Merge pull request #9867 from storybookjs/websocket-cyclic-support
  • 57dd1e0 Merge pull request #9834 from davidgoli/support-jsx-preview-files
  • dd47540 Merge pull request #8897 from fraincs/#8504
  • c25cb3f Merge pull request #9906 from SoloJiang/chore-supplement-rax
  • d28e4a3 Merge pull request #9874 from dmartinjs/patch-3
  • 1995d87 Merge pull request #9894 from davidenglishmusic/docs-configuration-file-typos
  • 654aeb9 Merge pull request #9885 from gaguirre/patch-3
  • 853c72a Merge pull request #9857 from pchr-srf/patch-4
  • c2e39d2 Merge pull request #9844 from tskarhed/patch-4

There are 41 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

aspect-ratio.css may get optimised away by webpack

I'm using react-apsect-ratio v1.0.42 in a site built with Gatsby v2.24.50

I'm finding that when deploying the web site, the aspect-ratio.css file is not included (although it works when in development mode). This means that the aspect-ratio is not set properly, and the styled element collapses to zero height.

Searching for solutions, I found this: gatsbyjs/gatsby#19446

Essentially, this suggests that the CSS gets optimised away by Webpack. The work-around, which works for me, is to create a requirement for the CSS by not only importing it, but using the returned object somehow:

import rar from 'react-aspect-ratio/aspect-ratio.css';
console.log(rar); // work around overzealous dependency pruning

However, it says the problem stems from the consumed npm package declaring the CSS as side-effect free in package.json, which I see in react-aspect-ratio's package.json:

 "sideEffects": false

Apparently, CSS should be declared to have side-effects like this:

"sideEffects": [
    "*.css"
],

(As suggested on the webpack issue here: webpack/webpack#6741 (comment))

Thanks for your work react-aspect-ratio!

An in-range update of babel-loader is breaking the build 🚨

The devDependency babel-loader was updated from 8.0.5 to 8.0.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

babel-loader is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for 8.0.6
  • Migrate to pify (#785)
  • Reduced memory usage (#781)
Commits

The new version differs by 11 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of storybook-addon-jsx is breaking the build 🚨

The devDependency storybook-addon-jsx was updated from 7.1.3 to 7.1.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

storybook-addon-jsx is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v7.1.4

🏠 Internal

Authors: 2

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-jsx-a11y is breaking the build 🚨

The devDependency eslint-plugin-jsx-a11y was updated from 6.2.1 to 6.2.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-jsx-a11y is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Commits

The new version differs by 102 commits.

  • 057fb27 6.2.2
  • fc56208 Merge pull request #615 from evcohen/changelog--v6.2.2
  • 8c5f964 Changelog for v6.2.2
  • f82fbcb Merge pull request #614 from evcohen/update--jsx-ast-utils
  • 1c3e63a Update jsx-ast-utils to v2.2.1
  • c571293 Merge pull request #613 from evcohen/add-babel-to-dev-deps
  • c398d3a Add @babel/cli to the dev dependencies
  • 13b370c Merge pull request #610 from evcohen/greenkeeper/flow-bin-0.102.0
  • e28b81a Merge branch 'master' into greenkeeper/flow-bin-0.102.0
  • e3163e3 Merge pull request #603 from evcohen/another-attempt-at-eslint-v6
  • f121a78 Merge branch 'master' into another-attempt-at-eslint-v6
  • f3de162 Merge pull request #611 from evcohen/update-jsx-ast-utils
  • 91f17be Update ESLint to v6
  • 1eb9f19 Update jsx-ast-utils to 2.2.0
  • 313bc03 chore(package): update flow-bin to version 0.102.0

There are 102 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-import is breaking the build 🚨

The devDependency eslint-plugin-import was updated from 2.16.0 to 2.17.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Commits

The new version differs by 61 commits.

  • 0499050 bump to v2.17.0
  • f479635 [webpack] v0.11.1
  • 8a4226d Merge pull request #1320 from bradzacher/export-ts-namespaces
  • 988e12b fix(export): Support typescript namespaces
  • 70c3679 [docs] make rule names consistent
  • 6ab25ea [Tests] skip a TS test in eslint < 4
  • 405900e [Tests] fix tests from #1319
  • 2098797 [fix] export: false positives for typescript type + value export
  • 70a59fe [fix] Fix overwriting of dynamic import() CallExpression
  • e4850df [ExportMap] fix condition for checking if block comment
  • 918567d [fix] namespace: add check for null ExportMap
  • 2d21c4c Merge pull request #1297 from echenley/ech/fix-isBuiltIn-local-aliases
  • 0ff1c83 [dev deps] lock typescript to ~, since it doesn’t follow semver
  • 40bf40a [*] [deps] update resolve
  • 28dd614 Merge pull request #1304 from bradennapier/feature/typescript-export-type

There are 61 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of storybook is breaking the build 🚨

There have been updates to the storybook monorepo:

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the storybook group definition.

storybook is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Commits

The new version differs by 2659 commits ahead by 2659, behind by 214.

  • 269149b v5.1.0
  • ab0e369 5.1.0 changelog
  • 5441456 Bump version to 5.1
  • d477111 Merge pull request #6913 from zxl634/patch-1
  • 006615a Mention TSX index file requirement in README (#6887)
  • db75c0a Update RN guide for 5.1 (#6977)
  • 4750688 Update RN guide for 5.1
  • 76ab1b4 5.1.0-rc.5 next.json version file
  • db65f6c Update version.ts
  • 70d6fcd v5.1.0-rc.5
  • bdefc16 5.1.0-rc.5 changelog
  • 829bf39 FIX race condition in startup of verdaccio && FIX typos (#6956)
  • f43a9b2 FIX the customCanvas option (#6968)
  • 3dc444a WIP: Remove zonejs from devDeps; allow ^0.8.0 || ^0.9.0 (#6957)
  • 8792884 Merge pull request #6847 from CodeByAlex/feature/jest-design-changes

There are 250 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Support for npm v6

I'm receiving these warnings when I install the npm package:

npm WARN notsup Unsupported engine for [email protected]: wanted: {"npm":"^3.0.0 || ^5.0.0"} (current: {"node":"10.15.3","npm":"6.12.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

What is written in my package.json:

"react-aspect-ratio": "^1.0.41",

Will the package be supported for npm V6?

Note: I might interpret this wrong as I don't know much about npm.

An in-range update of eslint-plugin-flowtype is breaking the build 🚨

The devDependency eslint-plugin-flowtype was updated from 3.7.0 to 3.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-flowtype is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v3.8.0

3.8.0 (2019-05-08)

Features

  • parse docblock more robustly for onlyFilesWithFlowAnnotation usage (#404) (397b7a1)
Commits

The new version differs by 1 commits.

  • 397b7a1 feat: parse docblock more robustly for onlyFilesWithFlowAnnotation usage (#404)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Not working at all?

The following code won't work:

import { AspectRatio } from 'react-aspect-ratio';

<AspectRatio
    ratio="4/5"
    style={{
        maxWidth: '600px',
        backgroundImage: 'url(https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg)',
        backgroundSize: 'cover'
    }}
>...</AspectRatio>

This is the resulting output:

<div
    class="react-aspect-ratio-placeholder"
    style="max-width: 600px; background-image: url("https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg";);background-size: cover; --aspect-ratio:(0.8);"
>
   ...
</div>

But it just gets render like a regular div...

None of the examples provided work either! The package is properly installed. What am I missing?

Unexpected token: keyword (const) by UglifyJs

Hey. Thanks for this great tiny library. When bundling entire app with Webpack I'm getting an error about unexpected usage of const in dist/es/index.js from UglifyJs. Could this be fixed to use var instead of const?

An in-range update of eslint-plugin-react is breaking the build 🚨

The devDependency eslint-plugin-react was updated from 7.14.0 to 7.14.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v7.14.1

Fixed

  • Fix prop-types crash on multiple destructuring (#2319 @golopot)
Commits

The new version differs by 3 commits.

  • 62255af Update CHANGELOG and bump version
  • 655eb01 Merge pull request #2320 from golopot/issue-2319
  • 9639d82 [Fix] prop-types: fix crash on multiple destructuring

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Images still popping in after aspect-ratio set.

I apologize for my ignorance, but do I have to explicitly send the pre-calculated aspect ratio as a prop to this? I thought passing {1} would preserve the ratio that shows and adjust accordingly.

An in-range update of babel7 is breaking the build 🚨

There have been updates to the babel7 monorepo:

    • The devDependency @babel/cli was updated from 7.4.4 to 7.5.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.