0.1.5 • Published 12 months ago
react-maintenance v0.1.5
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.
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-maintenanceUsage/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:
| Prop | Type | Default Value | Description |
|---|---|---|---|
children | ReactNode | null | The content to render when the application is not in maintenance mode or the IP is allowed. |
CustomeComponent | ReactNode | null | A custom React component to display during maintenance mode. If not provided, a default message is shown. |
allowedIPs | array | [] | An array of IP addresses allowed to bypass maintenance mode. |
Notes
- Environment Variable: The
Maintenancecomponent checks theREACT_APP_PRODUCTIONenvironment 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/jsonAPI. Make sure your application has access to this service or replace it with another API if needed.
🔗 Author Details
0.1.5
12 months ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago
0.0.30
1 year ago
0.0.29
1 year ago
0.0.28
1 year ago
0.0.27
1 year ago
0.0.26
1 year ago
0.0.25
1 year ago
0.0.24
1 year ago
0.0.23
1 year ago
0.0.22
1 year ago
0.0.21
1 year ago
0.0.20
1 year ago
0.0.19
1 year ago
0.0.18
1 year ago
0.0.17
1 year ago
0.0.16
1 year ago
0.0.15
1 year ago
0.0.14
1 year ago
0.0.13
1 year ago
0.0.12
1 year ago
0.0.11
1 year ago
0.0.10
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago
0.0.0
1 year ago