github.com/uchennaokeke444/nomad@v0.11.8/website/components/placement-table/index.jsx (about) 1 import { Fragment } from 'react' 2 3 export default function PlacementTable({ groups = [] }) { 4 return ( 5 <table className="g-placement-table"> 6 <thead> 7 <tr> 8 <td width="120" className="head"> 9 Placement 10 </td> 11 <td> 12 {Array.isArray(groups[0]) ? ( 13 groups.map(subgroup => { 14 return ( 15 <Fragment key={subgroup.join('')}> 16 <code 17 dangerouslySetInnerHTML={{ 18 __html: wrapLastItem(subgroup, 'strong').join(' -> ') 19 }} 20 /> 21 <br /> 22 </Fragment> 23 ) 24 }) 25 ) : ( 26 <code 27 dangerouslySetInnerHTML={{ 28 __html: wrapLastItem(groups, 'strong').join(' -> ') 29 }} 30 /> 31 )} 32 </td> 33 </tr> 34 </thead> 35 </table> 36 ) 37 } 38 39 function wrapLastItem(arr, wrapper) { 40 arr[arr.length - 1] = `<${wrapper}>${arr[arr.length - 1]}</${wrapper}>` 41 return arr 42 }