feat: render game grid as React component via SymfonyUX

This commit is contained in:
thibaud-leclere
2026-03-28 13:19:13 +01:00
parent 1640d8d9d9
commit 748b1c7a08
3 changed files with 40 additions and 24 deletions

View File

@@ -0,0 +1,27 @@
import React from 'react';
export default function GameGrid({ grid, width, middle }) {
return (
<table id="actors">
<tbody>
{grid.map((row, rowIndex) => (
<tr key={rowIndex}>
{Array.from({ length: width + 1 }, (_, colIndex) => {
const start = middle - row.pos;
const charIndex = colIndex - start;
const name = row.actorName;
const isInRange = charIndex >= 0 && charIndex < name.length;
const isHighlighted = charIndex === row.pos;
return (
<td key={colIndex} style={isHighlighted ? { color: 'red' } : undefined}>
{isInRange ? name[charIndex].toUpperCase() : ''}
</td>
);
})}
</tr>
))}
</tbody>
</table>
);
}