import { h } from "@stencil/core";
import { createStyleSheet } from "../../styling/JSS";
export function ReferralIframeView(props) {
  const { states, data } = props;
  const { content } = states;
  // dependent on props
  const style = {
    Container: {
      position: "relative",
      width: content.iframeWidth,
      height: content.iframeHeight,
    },
    IFrame: {
      position: "absolute",
      width: "100%",
      height: "100%",
      border: "0",
      top: "0",
      left: "0",
      right: "0",
    },
  };
  // JSS config
  const sheet = createStyleSheet(style);
  const styleString = sheet.toString();
  return (h("div", { class: sheet.classes.Container },
    h("style", { type: "text/css" }, styleString),
    h("iframe", { class: sheet.classes.IFrame, src: `${content.iframeSrc}?${encodeURIComponent(content.codeParam)}=${data.shareCode}` })));
}
