Skip to content

jf423/react-progressive-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-progressive-component

license

Example

Installation

$ npm install react-progressive-component --save (or yarn add ...)

Usage

Div

<ProgressiveImg
  src={pic1}
  loader={small_pic1}
  loaderStyle={'min-width: 100vw;height: 100vh;'}
>
    <div
      style={{
        minWidth: '100vw', height: '100vh',
        background: `url(${pic1}) center center / cover no-repeat`
      }}
    />
</ProgressiveImg>

Img

<ProgressiveImg
  src={pic2}
  loader={small_pic2}
  loaderStyle={'width: 100vw'}
>
  <img
    src={pic2}
    style={{ width: '100vw' }}
  />
</ProgressiveImg>

Property

Prop Type Required Default Description
src string yes ------ Origin image
loader string yes ------ Compress image
loaderStyle string option filter: blur(10px); The style of the loader.

CONTRIBUTING

All contributions and stars are super welcome! Please feel free to pull request.

LICENSE

MIT