npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-child-lock

v1.0.2

Published

Add a simple & customizable lock to prevent your site from being accessed by users while under development

Downloads

4

Readme

React-Child-Lock

Add a simple lock to prevent your site from being accessed by users while under development

NPM JavaScript Style Guide

Description

React-Child-Lock is a simple & customizable way of preventing un-wanted users from visiting your site. This library is in no way secure as the password is simply passed as a prop, hence the name child lock. Please do not use this library to restrict access to confidential/secure information. The intent of this is to prevent users from acessing a project under development and thinking it's a finished product.

The default Splash Screen

Install

npm install --save react-child-lock

Usage

ChildLock

This the easiest way to get started, which uses the default password; Password.

import React from 'react';
import ChildLock from 'react-child-lock';

export default function App() {
    return (
        <div className="app">
            <ChildLock/>
            // Rest of your code goes here
        </div>
    )
}

Customization

React-Child-Lock can be customized by passing the following optional props

  • password: A string containing the password you wish to use.
  • localStorage: A boolean for whether or not to use localStorage to save the password locally on the device. If true the user will only have to enter the password once (defaults to false).
  • customContent: An element/component containing content to be placed above the password input, as seen in the screenshot above.
  • background: An object to customize the background of the login screen containing one of the following:
    • image: A string containing a path to an image (defaults to a random image from Unsplash).
    • color: A string with a colour to be used for the background.
  • inputLabelText: A string containing the text for the input label (defaults to "Password:").
  • buttonText: A string containing the text for the button (defaults to "Enter Site").
  • errorText: A string containing the text for the error message (defaults to "Sorry, that password is incorrect").

Full Example:

import React from 'react';
import ChildLock from 'react-child-lock';
import warning from './warning.png';

export default function App() {
    return (
        <div className="app">
            <ChildLock
                password="earlyAccess!"
                localStorage={true}
                customContent={<BetaNotice/>}
                background={{color: "blue"}}
                inputLabelText="Access Code:"
                buttonText="Enter"
                errorText="Incorrect password, please try again."
            />
            <h1>WELCOME TO MY SITE</h1>
        </div>
    )
}

export function BetaNotice() {
    return (
        <div style={{display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center"}}>
            <p>We're under development!</p>
            <img src={warning} alt="Warning symbol"/>
            <p>Only users with the access code may enter</p>
        </div>
    );    
}

The fully customized example

License

MIT © Jordan-Morrison