2020-02-06 23:45:31 +00:00
|
|
|
import { Fragment } from 'react'
|
|
|
|
|
|
|
|
export default function PlacementTable({ groups = [] }) {
|
|
|
|
return (
|
|
|
|
<table className="g-placement-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td width="120" className="head">
|
|
|
|
Placement
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{Array.isArray(groups[0]) ? (
|
2020-09-30 13:48:40 +00:00
|
|
|
groups.map((subgroup) => {
|
2020-02-06 23:45:31 +00:00
|
|
|
return (
|
|
|
|
<Fragment key={subgroup.join('')}>
|
|
|
|
<code
|
|
|
|
dangerouslySetInnerHTML={{
|
2020-09-30 13:48:40 +00:00
|
|
|
__html: wrapLastItem(subgroup, 'strong').join(' -> '),
|
2020-02-06 23:45:31 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<br />
|
|
|
|
</Fragment>
|
|
|
|
)
|
|
|
|
})
|
|
|
|
) : (
|
|
|
|
<code
|
|
|
|
dangerouslySetInnerHTML={{
|
2020-09-30 13:48:40 +00:00
|
|
|
__html: wrapLastItem(groups, 'strong').join(' -> '),
|
2020-02-06 23:45:31 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
</table>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
function wrapLastItem(arr, wrapper) {
|
|
|
|
arr[arr.length - 1] = `<${wrapper}>${arr[arr.length - 1]}</${wrapper}>`
|
|
|
|
return arr
|
|
|
|
}
|