import React from 'react';
import Iframe from 'react-iframe';
import { connect } from 'react-redux';
const ShareFrame = props => {
  const state = props.location.state || {};

  if (!state.linkUrl) {
    return null;
  }
  const { token, userInfo } = props.global;

  return (
    <Iframe
      url={`${state.linkUrl}?token=${token}&loginName=${userInfo.loginName}`}
      width="100%"
      height="100%"
      id="myId"
      frameBorder="0"
      className="myClassname"
      display="initial"
      position="relative"
    />
  );
};

const mapStateToProps = state => ({
  global: state.getIn(['global', 'globalConfig']),
});
export default connect(mapStateToProps)(ShareFrame);
