/* eslint-disable @typescript-eslint/no-explicit-any */
import { createElement } from 'react';
import { TailwindPlayCommonParams } from '@/TailwindPlay/Fields/types.js';
import { extractHusarData } from '@/TailwindPlay/shared/extract.js';
import { isValidHtmlComponent } from '@/TailwindPlay/shared/constants.js';

export const FieldContent: React.FC<TailwindPlayCommonParams> = (props) => {
  const { v, attributes } = extractHusarData<string>(props);
  const tag = isValidHtmlComponent(attributes);
  return createElement(tag, { ...attributes, dangerouslySetInnerHTML: { __html: v } });
};
