react-stack-gallery
A simple component for React that provides gallery like 'pinterest'
Tech
Installation
npm install [--save-dev] react-stack-gallery
Usage
const App = { return <Gallery> <img src="1.jpg" style=width: '100%' /> <img src="2.jpg" style=width: '100%' /> <img src="3.jpg" style=width: '100%' /> </Gallery> }
or
const App = { return <Gallery> <div className="image" style=width: '100%'>element</div> <div className="image" style=width: '100%'>element</div> <div className="image" style=width: '100%'>element</div> </Gallery> }
TypeScript:
const App: React.FC = { return <Gallery> <img src="1.jpg" style=width: '100%' /> <img src="2.jpg" style=width: '100%' /> <img src="3.jpg" style=width: '100%' /> </Gallery> }
Props
<Gallery screen=1200 lines=5 marginPerc=003>
props | description |
---|---|
screen | Specify the overall width in px. (default: window.innerWidth) |
lines | The number of items to be placed side by side.(default: 2) |
marginPerc | Set the margin. (default: 0.04) |
Example
$ git clone git://github.com/hktysk/react-stack-gallery.git$ cd react-stack-gallery$ npm start