Hellenic / react-hexgrid

Build interactive hexagon grids with React
https://hellenic.github.io/react-hexgrid/examples/
MIT License
318 stars 130 forks source link

add style prop to hexagon #13

Closed cachilders closed 6 years ago

cachilders commented 6 years ago

I added a style prop to the Hexagon component for my own project and thought it might be useful to others. It explicitly anticipates a string in the 'fill:red;stroke:1;etc' style, but will render any old style object as well. Btw, I love this library. Thanks for sharing it.

Hellenic commented 6 years ago

Hey! Cheers, sounds like a addition that could be useful. I guess for the most parts passing in a className would do the trick, but I guess sometimes it's handy to override it with styles, or just pass hex-specific styles.

However, isn't style prop supposed to be an object? Now the prop type is set to be a string. Also, if could update the snapshot (or even add this in to a test). Once the test passes I'll be happy to merge this in.

cachilders commented 6 years ago

No lie, I went back and added those changes, pushed, and just now saw your comment. I went with the string just because it seems preferred by the SVG docs I scanned in MDB, but I personally used an object and felt like a hypocrite.

cachilders commented 6 years ago
screen shot 2017-11-13 at 12 48 54 am

Fwiw, my implementation needed programmatically derived fills, so it could be more of an edge use.