A simple flexbox-based React library for creating photo galleries, or pretty much anything you want to display in a grid layout
https://react-gallery.now.sh/
The demo site also includes a playground where you can intereact with the library live.
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;
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
now loginnow secrets lsnow secrets add REACT_APP_UNSPLASH_ACCESS_KEY <secret-value>now secrets add REACT_APP_UNSPLASH_SECRET_KEY <secret-value>
- to trigger a production build, run
now --prod; or, while on themasterbranch, rungit push - to trigger a staging build, run
noworgit pushto a branch
npm loginnpm publish --access public