Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

ajm113/preact-lazy-img

Repository files navigation

preact-lazy-img

STATUS Build Status

Lazy load images when the user scrolls over them.

NOTE: DO NOT USE IN PRODUCTION! STILL WORK IN PROGRESS!!!!

Foundation based on react-lazy

Install

    $ npm install preact-lazy-img

Usuage Example:

import {LazyImg, LazyImgWrapper } from 'preact-lazy-img';

<LazyImgWrapper>
    <LazyImg src='/asset/myimage.png'>
</LazyImgWrapper>
.lazyload-placeholder {
    background: gray;
    height: 300px;
    width: 300px;
    display: inline-block;
}

Todos:

  • Implement Travis CI.
  • Write more unit tests surrounding LazyImg and LazyImgWrapper.
  • Create CodePen Demo.
  • Allow child LazyImg props to be overwrite parent LazyImgWrapper.
  • Write more documentation around available props.
  • Upgrade to Webpack 4. (low)

Credits

  • Preact
  • Babel
  • Eslint
  • Jest
  • Enzyme
  • Webpack

License

MIT

About

A simple to use lazy image loader/unloader written for Preact. 💤

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published