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-switch-off-light

v1.0.11

Published

It's a light component manager helper to manage switching off/on light on web elements

Downloads

7

Readme

React Switch Off Light

A tiny helper Light Manager

Many Websites provides a lot of contents, sometimes visitors want to focus on viewing just a specific content, if you have this issue this helper is the perfect for you ! This helper works as a light switch who can switch on or off the light of your targeted element !

Click me to see a demonstration ✋ !

Table of Contents


Introduction


► Specifications :

• Easy to use 😉 • Place it anywhere in your code, it'll work 🎯 • All Browsers(IE, Firefox, Chrome ...) Support 🚀

► Actual & Upcoming Features :

     ☑️ Wrap Light Zone and Focused Zone Content      ☑️ Supporting Multiple Switch Off Elements      ⏹️ Display default Icon to trigger the action of switch off

Getting Started


It's simple whether you are a newbie or expert with React, just by following the instructions below you'll be able to use this library and do this cool stuff !

► Prerequisites

Since you are working with react, it's fine you'll not need to install any other dependancy, 'React >= 16.0' is the only dependancy of this helper 🤗.

► Installing

This package is available in npm repository as react-basic-items-pagination.

npm install react-switch-off-light --save

Or by Using Yarn.

yarn add react-switch-off-light --save

Now wherever you want in your project, you can import it

import FocusedContent from "react-switch-off-light";

► Example

It's so simple ;) , wrap the element you want to focus on ↓↓↓ check the example below ↓↓↓

The sample code to focus on box3 :

<div
    className="box2"
>
<FocusedContent.Component>
    <div
        className="box3"
    >
    My Content
    </div>
</FocusedContent.Component>
</div>

You can also choose the zone area where the light will be changed :

<FocusedContent.LightZone>
    <div
        className="box1"
    >
    <div
        className="box2"
    >
    <FocusedContent.Component>
        <div
            className="box3"
        >
        My Content
        </div>
    </FocusedContent.Component>
    </div>
</FocusedContent.LightZone>

Now, you can trigger the action by using :

<FocusedContent.LightZone>
    <div
        className="box1"
    >
    <div
        className="box2"
    >
    <FocusedContent.Component>
        <div
            className="box3"
        >
        <img
            src={LightIcon}
            className="light-icon"
            onClick={
            () => {
                // The action that trigger the switch off 
                // You can use it anywhere
                FocusedContent.switchOff();
            }
            }
        />
        My Content
        </div>
    </FocusedContent.Component>
    </div>
</FocusedContent.LightZone>

You can see the demonstration code in this link

Authors


  • Boumhicha El Mehdi - Initial work - Elmehdibm

License


This project is licensed under the MIT License - see the LICENSE.md file for details