3.0.0 • Published 1 year ago

responsive-responsive-img-material-ui v3.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

responsive-img-material-ui Weekly downloads

A material-ui component which displays an image from different sources based on the page's current width (based on material-ui defined breakpoints).

The order of breakpoints: xs, sm, md, lg, xl. You can find here the values defined currently by material-ui for these breakpoints.


Demo

You can access the storybook for this component here.

Props

The component accepts the props defined bellow in the table.

Props accepted by ResponsiveImgMaterialUi

NameTypeRequiredDefaultDescription
idstringnoundefinedThe id of the field
lgstringno*undefinedSource used for the lg breakpoint and wider screens (if not overridden)
mdstringno*undefinedSource used for the md breakpoint and wider screens (if not overridden)
smstringno*undefinedSource used for the sm breakpoint and wider screens (if not overridden)
xlstringno*undefinedSource used for the xl breakpoint and wider screens (if not overridden)
xsstringno*undefinedSource used for the xs breakpoint and bellow, and wider screens (if not overridden)
styleCSSPropertiesnoundefinedThe style applied to the field

no* means that at least one of them should be defined or an exception is triggered.


Versions

ResponsiveImgMaterialUi usesMaterial-uiReact
1.0.x3.9.316.8.6
2.0.x4.0.216.8.6
2.1.x4.2.016.8.6
2.2.x4.3.316.9.0
2.3.x4.9.016.9.0
2.4.x4.9.716.9.0
2.5.x4.10.216.9.0
2.6.x4.11.016.9.0
2.7.x4.11.316.9.0 or 17.0.0
3.0.x5.10.17>=18.0.0

About versioning schema used for ResponsiveImgMaterialUi

  • Major - it will be increased if the major version of the dependat package changes or there are breaking changes in the code of ResponsiveImgMaterialUi
  • Minor - it will be increased if no major version of the dependat package changes, but there are changes of the minor or patch versions of it
  • Patch - it will be increased if there are no changes of the dependat packages, but there are non breaking changes in the code of ResponsiveImgMaterialUi

Example

Displaying an image in three sizes based on the current window size:

import * as React from 'react';
import ResponsiveImgMaterialUi from 'responsive-img-material-ui';

class App extends React.Component {
  render() {
    return (
      <div className="App">
        <ResponsiveImgMaterialUi
          xs="/img/logo-small.jpg"
          md="/img/logo-medium.jpg"
          lg="/img/logo-large.jpg"
        />
      </div>
    );
  }
}

export default App;

Changelog

1.0.1

  • responsive-img-material-ui is made publicly available

1.0.2

  • Corrected the way we decide which provided src is used

2.0.0

  • Updated packages

2.1.0

  • Updated packages

2.2.0

  • Updated packages

2.3.0

  • Updated packages

2.4.0

  • Updated packages
  • Moved from npm to yarn

2.5.0

  • Updated packages

2.6.0

  • Updated packages

2.6.1

  • Fixed crash produced by "export * from"

2.7.0

  • Accepting React 17 as peerDependencies
  • Fixed security warnings

3.0.0

  • Migrated to material-ui 5
  • Supports minimum React 18