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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-popup-announcement

v1.0.4

Published

A React popup announcement component.

Downloads

86

Readme

Install

npm install --save react-popup-announcement

Usage

import * as React from "react";
import Image from "./image.svg";
import Announcement from "react-popup-announcement";

class Example extends React.Component {
  render() {
    return (
      <Announcement
        title="Here is your component"
        subtitle="The best announcement component for React is finally here. Install it in all your projects."
        link="https://github.com/kristofferandreasen/react-popup-announcement"
        imageSource={Image}
        buttonText="Click here!"
      />
    );
  }
}

Usage with optional properties

This example includes the optional properties in the component.

The daysToLive property changes to the cookie created by the component. This way you can control how many days you want to wait before you show the announcement to the same user.

The secondsBeforeBannerShows property changes the number of seconds a user waits before the announcement is presented.

The closeIconSize is to allow you to change to size of the icon in the top right corner.

The animateInDuration changes the duration of the fade-in animation.

The animateOutDuration changes the duration of the fade-out animation - this is fired on the click of the close icon.

import * as React from "react";
import Image from "./image.svg";
import Announcement from "react-popup-announcement";

class Example extends React.Component {
  render() {
    return (
      <Announcement
        title="Here is your component"
        subtitle="The best announcement component for React is finally here. Install it in all your projects."
        link="https://github.com/kristofferandreasen/react-popup-announcement"
        imageSource={Image}
        buttonText="Click here!"
        daysToLive={3}
        secondsBeforeBannerShows={20}
        closeIconSize={30}
        animateInDuration={2000}
        animateOutDuration={500}
      />
    );
  }
}

Properties

| Property | Type | Required | Default value | Description | | :------------------------- | :------------------------------------------------ | :------- | :------------ | :-------------------------------------------------------------------------------------------------------------------------------- | | title | string | yes | | The title of the announcement | | subtitle | string | yes | | The general card text on the announcement | | imageSource | string | yes | | The image source string used on the left side of the image. Use a square image for the best results. Dimensions are 68x68 pixels. | | onBannerClick | (event: React.MouseEvent) => void | yes | | The function triggered on click on the banner. | | buttonText | string | yes | | The text displayed on the button. | | daysToLive | number | no | 7 | An optional property specifying the number of days the cookie will live before the announcement is shown again to a user. | | secondsBeforeBannerShows | number | no | 5 | The number of seconds a user has to keep the page open before the announcement is shown. | | animateInDuration | number | no | 1000 | Changes the duration of the fade-in animation. | | animateOutDuration | number | no | 30 | Change the duration of the fade-out animation. |


Developing

The project is bootstrapped with create-react-library and TypeScript has been added to the project. You can read more about the development workflow in the project docs.

To start developing, you need to open two terminals.

In the first tab, run from the main directory:

npm start

This will activate rollup to watch for any changes to your src directory and build the dist everytime.

In another terminal, navigate to the example folder:

cd example

Then run:

npm install

and finally:

npm start

This will start up the development server allowing you to see the results. Be aware that the solution is setting a cookie and this cookie will be stored in your browser. In order to see the banner again, you will need to open the localhost link in incognito or clear your browser cookies.

Contributing

Your contributions are always welcome! Please have a look at the contribution guidelines first 🎉

License

MIT © kristofferandreasen