New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-column-gallery

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-column-gallery

An React Column Gallery in react.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source
  • 响应式可定制的图片展示组件
  • 保持图片宽高比
  • 自定义底部内容
  • 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 查看具体的定义

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

Photo每一项属性定义

属性类型默认值描述
keystring or numbersrc可选;组件中使用,确保列表内唯一。
srcstringundefined必传;图像地址。
widthnumberundefined必传;;图像的宽度(用于计算宽高比,可以不是真实值,但宽高比必须和原图一致)。
heightnumberundefined必传;图像的高度(用于计算宽高比,可以不是真实值,但宽高比必须和原图一致)。
altstringundefined可选;图像的alt文本。
loading"lazy" or "eager""eager"可选;用于设置 img 的loading 属性。

Keywords

react

FAQs

Package last updated on 28 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts