import React, { Component } from "react";

import popupPropTypes, {
  defaultProps,
  propsDescription
} from "./Popup.propTypes";

import SkeletonThemeWrapper from "../../customization-cornor/skeletonCustomization";
import { default as GeneralPopup } from "./__popupfunctionality";
import childrenWithProps from "./Popup.ComputeProps";

let SkeletonWrapper = (props) => {
  let { children, renderComponent, ...basicProps } = props;

  let childrenWithPropsData = childrenWithProps(props);
  let renderProps = { childrenWithPropsData };

  return (
    <SkeletonThemeWrapper
      basicProps={basicProps}
      renderProps={renderProps}
      component={renderComponent}
    />
  );
};
export function PopupBehaviour(props) {
  return <SkeletonWrapper {...props} />;
}

export function PopupTargetBehaviour(props) {
  let renderProps = {};
  let { renderComponent, ...basicProps } = props;
  return (
    <SkeletonThemeWrapper
      basicProps={basicProps}
      renderProps={renderProps}
      component={renderComponent}
    />
  );
}

export function PopupContentBehaviour(props) {
  let renderProps = {};
  let { renderComponent, ...basicProps } = props;
  return (
    <SkeletonThemeWrapper
      basicProps={basicProps}
      renderProps={renderProps}
      component={renderComponent}
    />
  );
}

export default GeneralPopup(PopupBehaviour);
PopupBehaviour.propTypes = popupPropTypes;
PopupBehaviour.defaultProps = defaultProps;
PopupBehaviour.propsDescription = propsDescription;
