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-photostream

v1.2.0-beta.1

Published

Simple photo gallery display to be seen as a continuous stream of images, no space inbetween.

Downloads

7

Readme

react-photostream

Travis npm package Coveralls

PhotoStream is a neat little React component to display a list of images in a compact fashion in columns, without gaps inbetween regardless of image size.

You can see a small demo here http://react-photostream.surge.sh/

To install:

npm install --save react-photostream

To use:

import React, {Component} from 'react';
import Photostream from 'react-photostream';

class VacationPictures extends Component {
  
  render() {

    let listOfImages = [
      "http://lorempixel.com/400/450",
      //...many images...
      "http://lorempixel.com/400/400"
    ];

    let listOfImageObjects = [
      {image:"http://lorempixel.com/400/450", altText:"first one"},
      //...many images...
      {image:"http://lorempixel.com/400/400", altText:"nth one"}
    ];

    return (
      <div>
        <h2>Images from vacation</h2>
        <PhotoStream imageList={listOfImages} />
        <hr />
        <h2>Detailes images from vacation</h2>
        <PhotoStream imageList={listOfImageObjects} />
      </div>
    );
  }

}

export default VacationPictures

Instructions

To render a wall of photos, you just need to pass to <PhotoStream /> a list of image links as property imageList. You can pass either an array of image links, or an object of the format { image, altText }. The image is the image link, and the altText is the alternate text to show on the photo itself (as the alt attribute on <img />).

Using custom event handlers

To use custom event handlers, pass to Photostream a prop called eventHandlers, which must be an object with any of the following: onClick, onMouseEnter, onMouseLeave.

import React from 'react';
import Photostream from 'react-photostream';

function Example(props){

  //When an image is clicked, the Component's image prop will be printed (which is the source of the image)
  const onClickEventHandler = function(event, self){
    console.log(self.props.image);
  }
  
  const images = ["image1", "image2", "image3"];
  
  return <Photostream eventHandlers={{onClick: onClickEventHandler}} imageList={images} />;
}

export default Example

Note: if your event handler needs to use information from the image component (say, if you want to use props) then the event handler should receive two arguments, event and self, where self is the this object of each Photo component.