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

@beisen-phoenix/result-page

v3.3.55

Published

## 导出组件

Downloads

229

Readme

结果页组件

导出组件

  • ImgResult - 用来渲染图片提示的结果页组件
  • IconResult - 用来渲染图标提示的结果页组件

有什么不同

图标结果页内置四个图标,尺寸有大小两种。自定义图标也受限于内置尺寸

图片结果页内置五张图片,400,403, 404, 500, 及一张默认图片, 默认图片大尺寸显示 150* 150, 小尺寸显示 100* 100. 其他内置图片显示 250*250, 并且不受大小尺寸的的影响。 自定义图片显示原始大小,不受尺寸限制。

接口

图片和图标共用接口

//尺寸的类型定义
export type TResultPageSize = 'sm' | 'lg';

// 按钮配置的类型定义
export interface IButtonItem {
  type?: 'secondary' | 'primary';
  text?: string;
  onClick?: (evt: any) => void;
}

//公用接口
interface IBaseProps {
  size?: TResultPageSize; // 尺寸, 可选值 'lg' | 'sm', 默认lg
  src?: string; // 图片(图标地址), 默认为空
  title?: string; // 标题, 默认为空
  content?: React.ReactNode; // 文字描述, 默认为空,可以传字符串,也可以传react elements,用来自定义渲染
  btns?: IButtonItem[]; // 按钮配置,
}

图片的专用接口

// 图片内置的可用值
type TImgResultPagePreset = '404' | '403' | '400' | '500';

// 通过preset参数接受
interface IImgResultPageProps extends IBaseProps {
  preset?: TImgResultPagePreset;
}

图标的专用接口

// 图标内置的可用值
type TIconResultPagePreset = 'fail' | 'success' | 'warn' | 'inform';
// 通过preset接受参数
export interface IIconResultPageProps extends IBaseProps {
  preset: TIconResultPagePreset;
}