0.1.5 • Published 6 months ago

react-maintenance v0.1.5

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

react-maintenance

react-maintenance is a lightweight React component that allows you to display a customizable maintenance mode screen for your application. It’s ideal for informing users about ongoing updates or downtime.

npm version License

Features

  • Simple and easy to use
  • Fully customizable message and styles
  • Supports dark and light themes
  • Responsive design for all devices
  • Quick setup with minimal configuration

Installation

Install the package using npm or yarn:

npm install react-maintenance

Usage/Examples

Import and use the Maintenance component in your React application:

// Import the Maintenance component
import React from 'react';
import Maintenance from 'react-maintenance';

const App = () => {
  // Configuration for Maintenance mode
  const maintenanceConfig = {
    CustomeComponent: <div>Maintenance mode on</div>, // Optional: Customize the message displayed during maintenance mode.
    allowedIPs: ['192.156.2.564', '651.25.1.54'], // Optional: List of IPs allowed to bypass maintenance mode.
  };

  return (
    <>
      {/* Wrap your application inside the Maintenance component */}
      <Maintenance {...maintenanceConfig}>
        {/* Content displayed when maintenance mode is off */}
        <div>Hello World</div>
      </Maintenance>
    </>
  );
};

export default App;

Props

The Maintenance component accepts the following props:

PropTypeDefault ValueDescription
childrenReactNodenullThe content to render when the application is not in maintenance mode or the IP is allowed.
CustomeComponentReactNodenullA custom React component to display during maintenance mode. If not provided, a default message is shown.
allowedIPsarray[]An array of IP addresses allowed to bypass maintenance mode.

Notes

  • Environment Variable: The Maintenance component checks the REACT_APP_PRODUCTION environment variable to determine if the app is in production mode. Set it to 'true' to enable maintenance mode.
  • IP Fetching: The user's IP address is fetched using the https://ipinfo.io/json API. Make sure your application has access to this service or replace it with another API if needed.

🔗 Author Details

portfolio linkedin

0.1.5

6 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago

0.0.30

6 months ago

0.0.29

6 months ago

0.0.28

6 months ago

0.0.27

6 months ago

0.0.26

6 months ago

0.0.25

6 months ago

0.0.24

6 months ago

0.0.23

6 months ago

0.0.22

6 months ago

0.0.21

6 months ago

0.0.20

6 months ago

0.0.19

6 months ago

0.0.18

6 months ago

0.0.17

6 months ago

0.0.16

6 months ago

0.0.15

6 months ago

0.0.14

6 months ago

0.0.13

6 months ago

0.0.12

6 months ago

0.0.11

6 months ago

0.0.10

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago

0.0.0

6 months ago