import React from "react";
import SkeletonThemeWrapper from "../../customization-cornor/skeletonCustomization";

export default class LinkBehaviour extends React.Component {
  constructor(props) {
    super(props);
    this.handlePreventDefault = this.handlePreventDefault.bind(this);
  }

  handlePreventDefault(e) {
    e && e.preventDefault && e.preventDefault();
    e && e.stopPropagation && e.stopPropagation();
    e &&
      e.nativeEvent &&
      e.nativeEvent.stopImmediatePropagation &&
      e.nativeEvent.stopImmediatePropagation();
    this.props.onClick && this.props.onClick(e);
  }

  render() {
    let renderProps = { handlePreventDefault: this.handlePreventDefault };

    let { renderComponent, ...basicProps} = this.props;
    return <SkeletonThemeWrapper basicProps={basicProps} renderProps={renderProps} component={renderComponent} />;
  }
}
