README
React Gallery
A simple flexbox-based React library for creating photo galleries, or pretty much anything you want to display in a grid layout
Demo
https://react-gallery.now.sh/
The demo site also includes a playground where you can intereact with the library live.
Usage
npm i -D @hustlelikeaboss/react-gallery
- Example:
import React from 'react'; import PropTypes from 'prop-types'; import * as ReGal from '@hustlelikeaboss/react-gallery'; const Masonry = ({photos, numOfCols}) => ( <ReGal.Masonry items={photos} numOfCols={numOfCols} /> ); Masonry.propTypes = { photos: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.number.isRequired, url: PropTypes.string.isRequired, description: PropTypes.string })), numOfCols: PropTypes.number }; export default Masonry;
Development
git clone
this project- obtain a pair of unsplash access key and secret here: https://unsplash.com/developers
- create an
.env
file in project root and add unsplash creds:REACT_APP_UNSPLASH_ACCESS_KEY=your_key_here REACT_APP_UNSPLASH_SECRET_KEY=your_secret_here
npm ci
npm start
Zeit deployment
initial setup
now login
now secrets ls
now secrets add REACT_APP_UNSPLASH_ACCESS_KEY <secret-value>
now secrets add REACT_APP_UNSPLASH_SECRET_KEY <secret-value>
deployment
- to trigger a production build, run
now --prod
; or, while on themaster
branch, rungit push
- to trigger a staging build, run
now
orgit push
to a branch
Publish
npm login
npm publish --access public