All files / web/src/lib/abacus-image render.tsx

0% Statements 0/12
0% Branches 0/1
0% Functions 0/1
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13                         
import React from 'react'
import { AbacusStatic } from '@soroban/abacus-react/static'
import type { AbacusStaticConfig } from '@soroban/abacus-react/static'

// Isolated in its own file so Next.js SWC doesn't block react-dom/server
// import in the API route (app router blocks static imports of react-dom/server)
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { renderToStaticMarkup } = require('react-dom/server') as typeof import('react-dom/server')

export function renderAbacusSvg(config: AbacusStaticConfig): string {
  return renderToStaticMarkup(React.createElement(AbacusStatic, config))
}