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

react-column-gallery

v0.1.0

Published

An React Column Gallery in react.

Downloads

12

Readme

React Column Gallery

  • 响应式可定制的图片展示组件
  • 保持图片宽高比
  • 自定义底部内容
  • SSR支持

Preview

效果图

Installation

yarn add react-column-gallery	
or
npm install react-column-gallery

Minimal Setup Example

const photos = [
  {
    src: 'http://example.com/example/img1.jpg',
    width: 4,
    height: 3
  },
  {
    src: 'http://example.com/example/img2.jpg',
    width: 1,
    height: 1
  }
];

<Gallery photos={photos} />;

API Documentation

可以查看 index.d.ts 查看具体的定义

| 属性 | 类型 | 默认值 | 描述 | | :-------------------- | :----------------------------------------------------------- | :-------- | :----------------------------------------------------------- | | photos | array | undefined | 一个Photo的数组,每一个项Photo的定义查看下面。 | | columns | number or function | - | 可选;列的数目或一个返回列数量的函数,参数为容器的宽度。若不设置,将使用内部的断点进行列的自适应变化。 | | spacing | number or { horizontal: number, vertical: number } or function | - | 可选的;用于设置横向和纵向的间距。 | | initialContainerWidth | number | 0 | 可选的;初始的容器宽度,用于SSR。 | | renderPhoto | function | undefined | 可选的;用于自定义图片渲染。 | | footerHeight | number | 0 | 可选的;图片底部内容高度,用于增加图片渲染额外信息。 | | renderFooter | function | undefined | 可选的;用于渲染底部内容。 |

Photo每一项属性定义

| 属性 | 类型 | 默认值 | 描述 | | :------ | :---------------- | :-------- | :----------------------------------------------------------- | | key | string or number | src | 可选;组件中使用,确保列表内唯一。 | | src | string | undefined | 必传;图像地址。 | | width | number | undefined | 必传;;图像的宽度(用于计算宽高比,可以不是真实值,但宽高比必须和原图一致)。 | | height | number | undefined | 必传;图像的高度(用于计算宽高比,可以不是真实值,但宽高比必须和原图一致)。 | | alt | string | undefined | 可选;图像的alt文本。 | | loading | "lazy" or "eager" | "eager" | 可选;用于设置 img 的loading 属性。 |