-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make extending of the last row optional #103
Conversation
So you've decided to use average height of previous rows for the last row. |
Yes, that will break it. you should see a React proptype warning in your console. Images has to be equal to or greater than columns. |
Yes, see it. |
It can be equal so if you want all your images on one row you can set columns to equal images.length. I don't think your solution would be used often. The user would need to update it across their breakpoints or it would break the layout. They also dont know what the last images could be. If its a portrait image you'd probably not want that to stretch across columns or the same amount of columns whereas if it was a panoramic or landscape you would. I think most people would want the images to look in proportion to previous ones. |
Agreed, thanks. |
Btw, would you be able to publish new version to npm? |
It was published a couple days ago |
Unfortunately, can't see any changes so far. (Updated version in package.json to 6.1.4, tested using codesandbox and local project). |
Sorry, forgot to build it. Also, I decided to remove the propType for column where it needs to be >= to the length of photos. It will work how it did where if its more, it will just adjust to the amount that exists. Will publish shortly |
Sorry, but there is an issue with adjusting of images. |
The columns don't adjust by themselves. Currently you have to dynamically change them yourself at a breakpoint of your choosing: http://neptunian.github.io/react-photo-gallery/examples/dynamic-columns.html In the next release, I plan to have default columns at default breakpoints. |
ah yes... that is a bug where the single image is too big. i'll look into it. |
There is an example of the same layout with the changes from my PR. |
The 1 image stretched across is acting correctly in the sense that if you have less images than you do columns its going to essentially fit width where columns will equal images. so the default behaviour that i need to implement is that if the user specifies more columns than images, the image should not stretch but leave room as if there were 3 images. In the case where there are more rows to find an average i can use that. In the case where there is only one row, i'll need to create an algorithm for that. |
Don't you like the algorithm I used? As for me, it makes sense to assume that average ratio will be the same for all row. And it gives the result I'd expect. |
Yes, i like it! I'll release the changes later today. thank you! |
Thank you! |
It's up on NPM now. |
Looks good! |
Default columns with masonry layout look very good! |
@rzhosan @neptunian from all this discussion I don’t understand what’s the solution for the problem. Thanks |
Hi @OriAmir . The solution should already be in the latest version of the library. |
@rzhosan @neptunian I am with the last version 6.2.0 and look ,
**width and height it's the original image size
this is the result , the second row is wrong.. Can I change anyway the row height of images or it's also automatically , I just want a gallery with thunmbail with normal height and width ? thanks again |
Hi all!
Images in the last row are extended to fill all the space regardless of the columns property (only single image will keep its size). The last row looks too giant if columns value is more than 3.
https://codesandbox.io/s/0olwwy50n0
So I amended the calculation of images width in the last row in utils.js file.
The default behavior hasn't been changed. But now it's possible to configure this behavior (set min count of images in the last row when it should be extended).
Also I added tests for it, changed styling in several files and changed the first example in order see that problem is solved (2 images don't fill the full size anymore).
This library is awesome, I really like it! Thank you very much!
I'm using it in production and the behavior described above has become a problem for me.
Could you please review this PR and provide your feedback about whether it's possible to commit my changes and publish the new version to npm?