This commit is contained in:
parent
db4b99aee3
commit
1dee8b528f
30 changed files with 3491 additions and 2444 deletions
34
website/src/features/games/mhwilds/cards/DamageTable.jsx
Normal file
34
website/src/features/games/mhwilds/cards/DamageTable.jsx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { assetPath } from "../utils.js";
|
||||
|
||||
export function DamageTable({ rows, t }) {
|
||||
if (!rows.length) return null;
|
||||
|
||||
const columns = Object.keys(rows[0]);
|
||||
|
||||
return (
|
||||
<div className="damage-table-wrap legacy-scrollbar">
|
||||
<table className="damage-table">
|
||||
<thead>
|
||||
<tr>
|
||||
{columns.map((column) => (
|
||||
<th key={column}>
|
||||
{column === "name" ? "" : <img src={assetPath(column)} alt={t(column, { capitalize: true })} title={t(column, { capitalize: true })} />}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row, rowIndex) => (
|
||||
<tr key={`${row.name}-${rowIndex}`}>
|
||||
{columns.map((column) => column === "name" ? (
|
||||
<td key={column} title={t(row[column], { capitalize: true })}>{t(row[column], { capitalize: true })}</td>
|
||||
) : (
|
||||
<td key={column}><img src={assetPath(`${row[column]}-stars`)} alt={`${row[column]} étoiles`} /></td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue