1.0.2 • Published 6 years ago
@hustlelikeaboss/react-gallery v1.0.2
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-galleryExample:
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 clonethis project- obtain a pair of unsplash access key and secret here: https://unsplash.com/developers
- create an
.envfile in project root and add unsplash creds:REACT_APP_UNSPLASH_ACCESS_KEY=your_key_here REACT_APP_UNSPLASH_SECRET_KEY=your_secret_here npm cinpm start
Zeit deployment
initial setup
now loginnow secrets lsnow 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 themasterbranch, rungit push - to trigger a staging build, run
noworgit pushto a branch
Publish
npm loginnpm publish --access public