import ReactMarkdown from 'react-markdown'
import remarkBreaks from 'remark-breaks'

/**
 * Rechtstext-Absatz aus Markdown (ohne Roht-HTML; Links mit target=_blank).
 */
export default function LegalDocumentBody({ content, muted }) {
  if (content == null || content === '') return null
  return (
    <div className={`legal-doc-body ${muted ? 'legal-doc-body--muted' : ''}`}>
      <ReactMarkdown
        remarkPlugins={[remarkBreaks]}
        components={{
          a: ({ href, children }) => (
            <a href={href} target="_blank" rel="noopener noreferrer">
              {children}
            </a>
          ),
        }}
      >
        {content}
      </ReactMarkdown>
    </div>
  )
}
