james-oldfield / react-rpg

:camera: Responsive photo grid component for react js
43 stars 8 forks source link

Great stuff! Allow an onclick handler to be specified on the image objects #2

Closed jch254 closed 8 years ago

jch254 commented 8 years ago

Hey @James-Oldfield, great work on this component! You've saved me re-inventing the wheel.

I was wondering if you could please allow an onclick handler to be specified on the image objects? Similar to the link that can be specified: https://github.com/James-Oldfield/react-rpg/blob/dev/src/components/react-rpg-photo.jsx#L25. I can open a PR if you'd rather me do this.

I also see you mentioned potentially making column count a function of browser width for single column on small devices etc. Any progress on this so far? Currently I'm doing this myself to display three columns on smaller devices and six columns on larger devices.

Cheers again for the great work, :+1:

james-oldfield commented 8 years ago

Thanks @jch254!

Being able to pass down an onClick handler function makes so much sense. Great idea!

As for the columns as a function of screen width, I haven't got round to adding it in.

A pull request for either would be absolutely amazing if you had the time. Please feel free! If you don't get round to it i'll try add at least the ability to pass a click handler function down through props on the weekend.

Thanks!

james-oldfield commented 8 years ago

Hey @jch254, finally got a little bit of time so i changed some things around so you can pass in a callback function to the onClick handler. Here's the demo online: http://james-oldfield.github.io/react-rpg/.

Would love your feedback. Thanks again for the suggestion! It's in version 1.0.0.

jch254 commented 8 years ago

Awesome stuff @James-Oldfield! I didn't end up using your component but it served as great inspiration for the mosaic in my project @ http://ai.603.nu. Thanks again!