Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
react-photo-gallery-next
Advanced tools
Fork react-photo-gallery. Responsive Justified React Image Gallery Component for Next.js
Row | Column |
---|---|
yarn add react-photo-gallery
http://neptunian.github.io/react-photo-gallery/
To build some examples locally, git clone and run:
yarn install
yarn start
Then open localhost:8000
in a browser.
const photos = [
{
src: 'http://example.com/example/img1.jpg',
width: 4,
height: 3
},
{
src: 'http://example.com/example/img2.jpg',
width: 1,
height: 1
}
];
<Gallery photos={photos} />;
This layout uses an algorithm adapted from the Knuth and Plass line breaking algorithm. It uses a graph to calculate the single best layout where each photo to break on is represented by a node and each edge is represented by a row. The cost of the edge is determined by the user provided targetRowHeight
vs the row height calculated if it were to break on this node/photo. What you end up with is a layout with rows that are similar in height and photos that are not being stretched or shrunken abnormally as is what happens in a naive implementation. This solves the issue of panoramas shrinking rows or having stragglers or stretched images at the last row, instead creating a justified grid. To make sure it's speedy the graph is being built as the shortest path is being calculated so the entire adjacency list is not calculated ahead of time. You can control how many neighboring nodes that Dijkstra's algorithm will search when it's visiting a node by adjusting the limitNodeSearch
property, but it's recommended you use the default algorithm. See documentation for recommendations.
Inspired by this blog article and this Google Photos blog article (under 2. Justified Gallery).
Goes through each column looking for the best place to insert the next photo by finding the shortest column. Not recommended for panorama aspect ratios.
Special thanks to Christopher Chedeau for writing about this interesting algorithm and whos code served as a starting off point.
FAQs
Fork react-photo-gallery. Responsive Justified React Image Gallery Component for Next.js
The npm package react-photo-gallery-next receives a total of 7 weekly downloads. As such, react-photo-gallery-next popularity was classified as not popular.
We found that react-photo-gallery-next demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.