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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mherrera/react-components

v1.4.0

Published

React components library

Readme

React Components

Build Status Codacy Badge Codacy Badge

Table of Contents

Overview

A collection of reusable React components for building modern user interfaces.

Installation

npm install --save @mherrera/react-components

Components

1. Copyable

Copyable Properties

| Property | Type | Description | Default | |----------|------|-------------|---------| | text | string | The text to be displayed and copied to clipboard | - | | copyIcon | string \| null | CSS class for the copy icon (e.g., fas fa-copy for FontAwesome, bi bi-clipboard for Bootstrap) | null | | checkIcon | string \| null | CSS class for the check icon shown after copying (e.g., fas fa-check for FontAwesome, bi bi-check for Bootstrap) | null | | copiedText | string \| null | Text to display when the text has been copied | 'Copied!' | | fadeOutTime | number | Time in milliseconds before the "copied" indicator fades out | 2000 |

Copyable Usage

import { Copyable } from './components';

export default function App() {
    return (
        <>
            <Copyable
                text="[email protected]"
                copyIcon="fas fa-copy"
                checkIcon="fas fa-check"
                copiedText="Email copied!"
                fadeOutTime={2000}
            />
        </>
    );
}

Alternative: Using text-based copy/check indicators

import { Copyable } from './components';

export default function App() {
    return (
        <>
            <Copyable
                text="https://example.com"
                copiedText="Link copied!"
            />
        </>
    );
}

2. GoogleAuthButton

GoogleAuthButton Properties

| Property | Type | Description | Default | |----------|------|-------------|---------| | googleLoginHost | string | URL for the Google Identity Services script (e.g. https://accounts.google.com/gsi/client) | - | | googleLoginClientId | string | OAuth 2.0 Client ID for your Google application | - | | googleLoginUrl | string | Redirect/login URI where Google sends the response | - |

GoogleAuthButton Usage

import { GoogleAuthButton } from './components';

export default function App() {
    return (
        <>
            <GoogleAuthButton
                googleLoginHost="https://accounts.google.com/gsi/client"
                googleLoginClientId="YOUR_GOOGLE_CLIENT_ID"
                googleLoginUrl="https://yourapp.com/auth/google"
            />
        <>
    );
}

3. Rolling Counter

Rolling Counter Properties

| Property | Type | Description | Default | |----------|------|-------------|---------| | fromValue | number | The starting value for the counter animation | 0 | | toValue | number | The ending value for the counter animation | - | | duration | number | Animation duration in milliseconds | 500 |

Rolling Counter Usage

import { RollingCounter } from './components';

export default function App() {
    return (
        <>
            <RollingCounter
                fromValue={0}
                toValue={100}
                duration={500}
            />
        </>
    );
}

Alternative: Basic counter with default starting value

import { RollingCounter } from './components';

export default function App() {
    return (
        <>
            <RollingCounter toValue={50} duration={1000} />
        </>
    );
}

4. Server Status

Server Status Properties

| Property | Type | Description | Default | |----------|------|-------------|---------| | onlineIcon | string | CSS class for the online icon (e.g., fas fa-circle for FontAwesome, bi bi-circle-fill for Bootstrap) | - | | offlineIcon | string | CSS class for the offline icon (e.g., fas fa-times-circle for FontAwesome, bi bi-circle for Bootstrap) | - | | refreshInterval | number | Polling interval in milliseconds to check server status | 180000 | | serverStatusService | IServerStatusService | Service instance for fetching server status | ServerStatusService.createDefault() |

Server Status Usage

import { ServerStatus } from './components';
import { ServerStatusService } from './services';

export default function App() {
    return (
        <>
            <ServerStatus
                onlineIcon="fas fa-circle"
                offlineIcon="fas fa-circle"
                refreshInterval={180000}
                serverStatusService={ServerStatusService.createDefault()}
            />
        </>
    );
}

Alternative: Using useMemo for the service

import { useMemo } from 'react';
import { ServerStatus } from './components';
import { ServerStatusService } from './services';

export default function App() {
    const serverStatusService = useMemo(
        () => ServerStatusService.createDefault(),
        []
    );

    return (
        <>
            <ServerStatus
                onlineIcon="fas fa-circle"
                offlineIcon="fas fa-circle"
                refreshInterval={180000}
                serverStatusService={serverStatusService}
            />
        </>
    );
}

Server Status Dependencies

The ServerStatus component follows a layered architecture with the following dependency chain:

  • Component Layer: ServerStatus depends on IServerStatusService to fetch server status periodically
  • Service Layer: ServerStatusService implements the service interface and depends on ServerStatusRepository to retrieve server status data
  • Repository Layer: InMemoryServerStatusRepository implements the repository interface and provides the actual data source

This architecture allows for flexible testing and swapping implementations. You can provide a custom repository implementation to ServerStatusService.create() to connect to different data sources without modifying the component.