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

leumas-react-flashlights

v1.0.4

Published

Simple CSS Flashlight effect for any Component or React Page, Perfect for Coming Soon Pages or any other creative website. Should not need any updates, but I might create more in the near future to compliment the Flashlight component

Downloads

11

Readme

React FlashLight Component

A React component that creates a flashlight effect on the entire screen. The screen goes dark, and only the area around the cursor is illuminated, allowing you to highlight parts of your content as you hover over them.

Installation

Install the package via npm:

npm install leumas-react-flashlights

Usage

To use the FlashLight component, wrap your content with it. Here's an example:

FlashLight Component (FlashLight.jsx)

import React from 'react';
import FlashLight from 'react-flashlight-effect';

const App = () => {
  return (
    <FlashLight>
      <div>
        <h1>Hello, world!</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit...</p>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit...</p>
      </div>
    </FlashLight>
  );
};

export default App;

Styling

Include the following CSS to achieve the flashlight effect:

CSS (FlashLight.css)

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
  cursor: none;
}

.flashlight-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.flashlight-content {
  font-size: 1em;
  text-align: justify;
  line-height: 1.8em;
  padding: 0.2em;
}

#flashlight {
  --Xpos: 50vw;
  --Ypos: 50vh;
}

#flashlight:before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  pointer-events: none;
  background: radial-gradient(
    circle 9em at var(--Xpos) var(--Ypos),
    rgba(0, 0, 0, 0),
    rgba(0, 0, 0, 1)
  );
}

@media screen and (max-width: 500px) {
  .flashlight-content {
    font-size: 14px;
  }
}

Additional Notes

  • Z-index Layering Issues: Since the flashlight effect relies on overlaying a dark layer on top of your content, you may encounter issues with z-index layers. Ensure that the FlashLight component and its styles are applied correctly and have a high enough z-index to function properly. Adjust the z-index values as necessary in your styles to avoid conflicts with other components.

  • Cursor Styling: The CSS provided sets cursor: none; to hide the cursor. This enhances the flashlight effect by making the light spot the only indicator of the cursor's position. If you need to display the cursor for any reason, you can adjust or remove this line in the CSS.

  • Touch Device Support: The component includes support for touch devices. It will track the touch position and update the flashlight effect accordingly.

For more detailed usage and examples, please refer to the documentation.