0.1.16 • Published 10 months ago

progressify-react v0.1.16

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Progressify React

Progressify React is a powerful React library for implementing progressive image loading using Sizeable. It provides easy-to-use components to enhance the image loading experience in your React applications.

Features

  • Progressive image loading
  • Lazy loading support
  • Thumbnail support
  • Easy integration with React applications
  • Customizable placeholder and image styles

Installation

Install Progressify React using npm or yarn:

npm install progressify-react
# or
yarn add progressify-react

Usage

Process Your Images

Use Sizeable To generate your images folder and index.json, which are REQUIRED to use progressify-react

Copy the contents of the generated zip to your apps public folder

ImageProvider

Wrap your application with the ImageProvider to provide the image context to your components:

import React from "react";
import { ImageProvider } from "progressify-react";
import App from "./App";

const Main = () => (
  <ImageProvider>
    <App />
  </ImageProvider>
);

export default Main;

ProgressiveImage

Use the ProgressiveImage component to display progressive images:

import React from "react";
import { ProgressiveImage } from "progressify-react";

const YourComponent = () => (
  <ProgressiveImage
    src="image-name"
    placeholderClassName="blur-lg"
    className="any-old-class"
    alt="Description of the image"
    thumb
    lazy
  />
);

export default YourComponent;

API Reference

ProgressiveImage

The ProgressiveImage component accepts the following props:

PropTypeDefaultDescription
srcstring(required)The source name of the image (as defined in your Sizeable configuration)
classNamestring''CSS class name for the image element
placeholderClassNamestring''CSS class name for the placeholder element
altstring''Alternative text for the image
thumbbooleanfalseWhether to use the thumbnail version of the image
lazybooleanfalseWhether to enable lazy loading for the image

Usage Tips

  • Use the thumb prop for smaller images or in list views to improve initial load times.
  • Enable lazy loading for images that are not immediately visible on page load.
  • Provide meaningful alt text for all images to improve accessibility.

Contributing

We welcome contributions to Progressify React! Please see our Contributing Guide for more details.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

If you encounter any issues or have questions, please file an issue on our GitHub repository.

0.1.16

10 months ago

0.1.15

10 months ago

0.1.14

10 months ago

0.1.13

10 months ago

0.1.12

10 months ago

0.1.11

10 months ago

0.1.10

10 months ago

0.1.9

10 months ago

0.1.8

10 months ago

0.1.7

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago