import Text from '../../Text/index.js';
import styles from './index.module.scss';
import ContentFields from './ContentFields.js';
import cx from '../../utils/classname.js';
import { AccordionContentProps } from './types.js';

const AccordionContentComponent = ({
  fieldPath,
  className = '',
  style = {},
  children,
}: AccordionContentProps) => {
  const combinedClasses = cx(styles.accordionContent, className);

  return (
    <div className={combinedClasses} style={style}>
      {fieldPath ? <Text fieldPath={fieldPath} /> : children}
    </div>
  );
};

type AccordionContentComponentType = typeof AccordionContentComponent & {
  ContentFields: typeof ContentFields;
};

const AccordionContent =
  AccordionContentComponent as AccordionContentComponentType;
AccordionContent.ContentFields = ContentFields;

export default AccordionContent;
