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-animated-border

v0.1.2

Published

The `AnimatedBorder` component adds a customizable animated border effect to its children. It is built with React and can be styled using CSS variables for easy customization.

Downloads

5

Readme

AnimatedBorder Component

The AnimatedBorder component adds a customizable animated border effect to its children. It is built with React and can be styled using CSS variables for easy customization.

Table of Contents

Installation

To use the AnimatedBorder component, install it via npm or yarn. Ensure that you have the required CSS file included in your project.

npm install react-animated-border

Usage Example

You can use the AnimatedBorder component in your application like this:

import React from "react";
import AnimatedBorder from "react-animated-border";

const App = () => {
  return (
    <div style={{ width: '400px', height: '400px'}}>
    <AnimatedBorder borderAnimationColor="rgba(255, 0, 0, 1)">
      <h1>Hello, World!</h1>
    </AnimatedBorder>
    </div>
  );
};

export default App;

Props

| Prop | Type | Required | Default | Description | |------------------------|-------------|----------|-------------------------------|---------------------------------------------------------------| | children | ReactNode | Yes | N/A | The content to be wrapped inside the animated border. | | borderAnimationColor | string | No | rgba(41, 141, 223, 1) | The color of the animated border. You can pass any valid CSS color value. | | Note | N/A | N/A | N/A | A div wrapper is added to the AnimatedBorder. Without it, the animated border will take the parent's width and height. Check the example for clarification. |

Animated Border Example

Animated Border Example

This image demonstrates the animated border effect.

useSpotlight Hook

The useSpotlight hook creates a spotlight effect that follows the mouse pointer within a component. It allows customization of the spotlight and hotspot colors.

Props

spotlightColor (optional)

  • Type: string
  • Default: "rgba(41, 141, 223, 0.3)"
  • Description: The color of the spotlight effect.

hotspotColor (optional)

  • Type: string
  • Default: "rgba(255, 255, 255, 1)"
  • Description: The color of the area outside the spotlight.

Props

| Prop Name | Type | Required | Default | Description | |------------------|--------|----------|------------------------------|---------------------------------------| | spotlightColor | string | No | "rgba(41, 141, 223, 0.3)" | The color of the spotlight effect. | | hotspotColor | string | No | "rgba(255, 255, 255, 1)" | The color of the area outside the spotlight. |

import React from 'react';
import useSpotlight from 'react-animated-border';

const SpotlightComponent = () => {
  const { handleMouseMove, spotlightStyle } = useSpotlight();

  return (
    <div
      onMouseMove={handleMouseMove}
      style={{ width: '100%', height: '400px', ...spotlightStyle }}
    >
      Hover over this area to see the spotlight effect!
    </div>
  );
};

export default SpotlightComponent;
import React from 'react';
import useSpotlight from 'react-animated-border';

const Example = () => {
  const { handleMouseMove, spotlightStyle } = useSpotlight('rgba(255, 0, 0, 0.5)', 'rgba(0, 0, 0, 0.8)');

  return (
    <div
      onMouseMove={handleMouseMove}
      style={{ width: '100%', height: '400px', ...spotlightStyle, position: 'relative' }}
    >
      <h2 style={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', color: '#fff' }}>
        Move your mouse here!
      </h2>
    </div>
  );
};

export default Example;

Example Image

Spotlight Effect Example

This image demonstrates the spotlight effect in action.