| 13 | const rows: TableRow[] = []; |
| 14 | |
| 15 | const addRow = (row: LegendRow, i: number) => { |
| 16 | const fn = symbolMap[row.symbol.shape]; |
| 17 | let jsx: JSX.Element; |
| 18 | if (fn) { |
| 19 | jsx = fn(row.symbol); |
| 20 | } else { |
| 21 | jsx = <span>x</span>; |
| 22 | //console.log(`need to render ${row.symbol.shape} symbol shape`); |
| 23 | } |
| 24 | rows.push({ |
| 25 | cells: [ |
| 26 | { className: 'symbol', content: jsx }, |
| 27 | { className: 'label', content: row.label, title: row.label }, |
| 28 | ], |
| 29 | }); |
| 30 | }; |
| 31 | |
| 32 | const sorted = Object.keys(props.legend.rows).sort((a, b) => +a - +b); |
| 33 | sorted.forEach(i => addRow(props.legend.rows[i], +i)); |