Created
February 1, 2022 19:34
-
-
Save kitze/01f5c998bd09f325b20ae0f7c25ee2ee to your computer and use it in GitHub Desktop.
rectangles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Rectangles = ({ | |
cols, | |
defaultBackground, | |
defaultBackgroundEmoji, | |
paints, | |
rows, | |
paint | |
}) => { | |
return ( | |
<L.Vertical> | |
{times(rows).map((r, rowIndex) => ( | |
<L.Horizontal key={rowIndex}> | |
{times(cols).map((c, columnIndex) => { | |
const foundPaint = findPaint({ paints, rowIndex, columnIndex }); | |
return ( | |
<Rectangle | |
onRightClick={(e) => { | |
e.preventDefault(); | |
paint({ rowIndex, columnIndex, paint: '' }); | |
}} | |
key={columnIndex} | |
onClick={() => { | |
paint({ rowIndex, columnIndex }); | |
}} | |
> | |
{renderRectangleContent({ | |
foundPaint, | |
defaultBackground, | |
defaultBackgroundEmoji | |
})} | |
</Rectangle> | |
); | |
})} | |
</L.Horizontal> | |
))} | |
</L.Vertical> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment