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

@a-drowned-fish/react-components

v1.0.12

Published

react-components

Downloads

141

Readme

React Components 库

一个轻量级的 React 组件集合,提供常用的 UI 组件,便于在 React 项目中快速集成使用。

安装

npm install @a-drowned-fish/react-components

组件列表

| 组件名 | 描述 | | ------- | ------ | | Popup | 浮窗 | | Loading | 加载中 |

快速开始

import React from "react";
import { Popup, Loading } from "@a-drowned-fish/react-components";

function App() {
    return <div>{/* 使用组件 */}</div>;
}

组件文档

1. Popup 浮窗组件

一个灵活的弹出层组件,支持多种位置和动画效果。

属性

| 属性名 | 类型 | 默认值 | 描述 | | --------------- | --------------- | ----------------------- | ---------------------------------------- | | visible | boolean | false | 控制弹出层显示/隐藏 | | maskClosable | boolean | true | 点击遮罩是否可关闭 | | className | string | "" | 自定义类名 | | bg | string | "rgba(0, 0, 0, 0.3)" | 遮罩背景颜色 | | duration | number | 200 | 动画持续时间(毫秒) | | edge | PopupEdge | PopupEdge.BOTTOM | 弹出位置(TOP/BOTTOM/LEFT/RIGHT/CENTER) | | scaleWhenCenter | ScaleWhenCenter | { start: 0.75, end: 1 } | 当 edge 为 CENTER 时的缩放效果 | | onClose | () => void | - | 关闭回调函数 | | children | ReactNode | - | 弹出层内容 |

示例

import { useState } from "react";
import { Popup, PopupEdge } from "@a-drowned-fish/react-components";

function MyComponent() {
    const [visible, setVisible] = useState(false);

    return (
        <>
            <button onClick={() => setVisible(true)}>打开底部弹出</button>
            <Popup visible={visible} onClose={() => setVisible(false)} edge={PopupEdge.BOTTOM} duration={300}>
                <div style={{ padding: "20px", backgroundColor: "#fff" }}>
                    <h3>底部弹出内容</h3>
                    <button onClick={() => setVisible(false)}>关闭</button>
                </div>
            </Popup>
        </>
    );
}

2. Loading 加载组件

一个简单的加载指示器组件,可用于页面加载、数据请求等场景。

属性

| 属性名 | 类型 | 默认值 | 描述 | | ---------- | --------- | ------ | --------------------- | | visible | boolean | false | 控制加载动画显示/隐藏 | | bg | string | - | 遮罩背景颜色 | | size | number | 30 | 加载图标大小 | | color | string | - | 加载图标颜色 | | injectBody | boolean | true | 是否注入到 body 元素 | | children | ReactNode | - | 自定义加载内容 |

示例

import { useState } from "react";
import { Loading } from "@a-drowned-fish/react-components";

function MyComponent() {
    const [loading, setLoading] = useState(false);

    const fetchData = () => {
        setLoading(true);
        // 模拟数据请求
        setTimeout(() => {
            setLoading(false);
        }, 2000);
    };

    return (
        <>
            <button onClick={fetchData}>加载数据</button>
            <Loading visible={loading} bg="rgba(255, 255, 255, 0.8)" size={40} color="#1890ff" />
        </>
    );
}