I have an array of object like this: { id, width, height, margin }
. And when i render that array and apply that information to react konva Rect component like this:
{
topSide.map((seat, index) => (
<Rect
id={seat.id}
key={seat.id}
fill="brown"
stroke="white"
width={seat.width}
height={seat.height}
x={topSideStartPosition + index * seat.width + seat.margin}
y={y * linesHeight - seat.height - 2}
/>
))
}
So my problem is seat.margin
is applying only for 1 rectangle. Generally i want to apply one value for the first rectangle and other value for rest
rectangles. seat.margin
is equal 1 if object index in array is 1 and equal 2 if object index is not equal 1. Here's how it looks:
result image