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

slides-react

v3.0.0

Published

slides-react react and use ts writer

Downloads

6

Readme

slides-react

一个npm包,使用 react 来实现的轮播图的 DOM 更新,我们没有使用定时器来实现, 使用了最新的CSS3 transition 和 transform 来实现轮播图的循环, 我们的项目还处于完善阶段,欢迎进行 fork。

项目演示地址:slides-react

安装

使用命令 npm add slides-react 或者 yarn add slides-react 来安装在你的项目依赖里

使用

import * as React from "react";
import * as ReactDOM from "react-dom";
import * as Slides from "./package";

import "./css/index.css";

const {
  SlideBox,
  SlideControl,
  SlideList,
  SlidePager,
} = Slides;

const list = [{
  href: "",
  src: require("./img/slides-img-1.jpg"),
}, {
  href: "",
  src: require("./img/slides-img-2.jpg"),
}, {
  href: "",
  src: require("./img/slides-img-3.jpg"),
}];

const App = () => <SlideBox list={list}>
  <SlideList />
  <SlidePager activeStyle={{ backgroundColor: "blue" }} />
  <SlideControl />
</SlideBox>;

ReactDOM.render(
  <App /> as any,
  document.getElementById("root")
);

提示

  1. 如果 SlideBox.children 下没有 SlideList,将使用默认的 SlideList。
  2. SlidePager, SlideControl 组件是可选的。

类型或者参数

declare type Direction = "left" | "right";
interface IOptions {
    direction?: Direction;
    duration?: string;
    timeout?: number;
}

interface ISlideListItem {
  src: string;
  href: string;
  alt?: string;
}

interface IProps {
  list: ISlideListItem[];
  options?: IOptions;
}

declare class SlideBox extends React.Component<IProps, IState> {
    constructor(props: IProps);
    componentDidMount(): void;
    render(): JSX.Element;
    ...
}

interface ISlidePagerProps {
    list?: ISlideListItem[];
    activeStyle?: React.CSSProperties;
}
declare const SlidePager: React.FunctionComponent<ISlidePagerProps>;

interface ISlideListProps {
    list?: ISlideListItem[];
}
declare const SlideList: React.FunctionComponent<ISlideListProps>;

interface ISlideControlProps {
    onPrev?: () => void;
    onNext?: () => void;
    onStop?: () => void;
    onStart?: () => void;
}
declare const SlideControl: React.FunctionComponent<ISlideControlProps>;

仓库地址

我们的仓库地址在码云上托管,使用列子你可以 clone 下来查看 slides-react

更新日志

  1. v1.0.0
  • 1.0.0 正式版发布了
  • 产品基本成型
  1. v2.0.0
  • 2.0.0 版本发布了
  • 内部轮播方式大修改
  • 接口 props 也修改了
  • 支持 手动轮播了(左右翻页)
  1. v2.0.1
  • 修改 README.md 里的命名错误
  1. v3.0.0
  • 组件命名大更新
  • 优化代码结构