willb335 / chessboardjsx

:black_square_button: Chessboard built for React
https://chessboardjsx.com
MIT License
270 stars 80 forks source link

feat(render): implement rendering pieces as a render-prop #20

Closed csharptest closed 6 years ago

csharptest commented 6 years ago

provides the ability to pass a render function as a pieces render property, the single argument provides width, height, and piece.

example:

<Chessboard
  pieces={{
    wQ: ({width, height, piece}) => (<div>queen</div>)
  }}
/>
codecov-io commented 6 years ago

Codecov Report

Merging #20 into master will decrease coverage by 0.11%. The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
- Coverage   65.28%   65.16%   -0.12%     
==========================================
  Files          11       11              
  Lines         265      267       +2     
  Branches       62       63       +1     
==========================================
+ Hits          173      174       +1     
- Misses         71       72       +1     
  Partials       21       21
Impacted Files Coverage Δ
src/Chessboard/RenderPieces.js 76.19% <50%> (-2.76%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a013e28...38ec437. Read the comment docs.

willb335 commented 6 years ago

I like this feature. This should clean up quite a bit of code as well. I have some time tomorrow to take a look at it. Thanks!

willb335 commented 6 years ago

Moved to #22