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

@wenmu/react-text-carousel

v1.0.4

Published

一个文本走马灯组件

Downloads

13

Readme

react-text-carousel

一个文字上下滚动的走马灯效果。这个是使用 css3 的动画实现,所以对浏览器版本有要求。

默认高度是 36px,如果需要调整,可根据 style 传递 height 进行设置。

效果图

效果图

图标位置

安装

npm i @wenmu/react-text-carousel --save

使用方式

import TextCarousel from "@wenmu/react-text-carousel";

<TextCarousel
  style={{ backgroundColor: "#e7e1e1", height: "50px" }}
  source={[
    { id: "1", text: "第一个" },
    { id: "12", text: "第2个" },
    { id: "3", text: "第3个" },
    { id: "4", text: "第4个" },
    { id: "5", text: "第5个" },
  ]}
  duration={2}
  icon={
    <img
      src="http://img.wangpengpeng.site/help.svg"
      alt=""
      style={{ width: "18px", height: "16px", display: "inline-block", marginRight: "7px" }}
    />
  }
  onClick={(item) => {
    alert(item.text);
  }}
/>;

属性介绍

| 属性名 | 默认值 | 类型 | 介绍 | | :-------- | ------ | ---------- | ---------------------------------------------------------------------------------- | | className | 空 | Object | 自定义样式类,css 以 module 的方式引入 | | style | 空 | Object | Object | 内嵌样式 | | contentStyle | 空 | Object | Object | 内容样式 | | source | [] | 数组 | 数据源 | | duration | 2 | number | 每项持续时间 | | icon | null | React.Node | 定义文字开头图标 | | keyField | id | string | key 属性的字段名称 | | textField | text | string | 显示内容的字段名称,默认是 text,如果要显示其他字段值,设置对应属性即可,比如 name | | onClick | 空方法 | function | 点击每项事件,参数是当前项 |