(text: string)
| 33 | } |
| 34 | |
| 35 | function htmlToJSX(text: string) { |
| 36 | const mapObj = { |
| 37 | 'class=': 'className=', |
| 38 | 'for=': 'htmlFor=', |
| 39 | '-rule': 'Rule', |
| 40 | 'stroke-l': 'strokeL', |
| 41 | 'stroke-w': 'strokeW', |
| 42 | '<!--': '{/*', |
| 43 | '-->': '*/}', |
| 44 | tabindex: 'tabIndex', |
| 45 | colspan: 'colSpan:', |
| 46 | rowspan: 'rowSpan:', |
| 47 | 'aria-*': 'aria-*', |
| 48 | 'data-*': 'data-*', |
| 49 | onclick: 'onClick', |
| 50 | onchange: 'onChange', |
| 51 | onblur: 'onBlur' |
| 52 | } |
| 53 | |
| 54 | const render = replaceAll(text, mapObj) |
| 55 | // TODO: it would cool to generate a name for our component |
| 56 | return `export default function Widget() { |
| 57 | return ( |
| 58 | ${render |
| 59 | .split('\n') |
| 60 | .map(line => ` ${line}`) |
| 61 | .join('\n')} |
| 62 | ) |
| 63 | }` |
| 64 | } |
| 65 | |
| 66 | interface ViewerProps { |
| 67 | id: string |
no test coverage detected