import React from 'react';
import style from './Accordion.module.css';
export default function AccordionItem(props) {
  let {
    isOpen,
    children,
    onClick,
    heading,
    index,
    position
  } = props;
  let directionObject = {
    left: 'row',
    right: 'row-reverse',
    bottom: 'column',
    top: 'column-reverse'
  };
  return /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: directionObject[position]
    }
  }, /*#__PURE__*/React.createElement("div", {
    className: style.title,
    onClick: () => onClick(index)
  }, heading(position)), /*#__PURE__*/React.createElement("div", {
    style: {
      display: isOpen ? 'block' : 'none'
    },
    className: style.content
  }, typeof children == "function" ? children(position) : children));
}