import * as React from "react";
import { ITestingProps, PluginProps } from "./types";
import { ComponentTypes } from "../types";

export const Testing: React.FC<ITestingProps> = ({
  properties = {},
  testId = "",
}) => {
  return (
    <div data-testid={testId} style={properties}>
      Testing Testing 123456
    </div>
  );
};

const TestingPluginComponent: React.FC<PluginProps> = ({ settings }) => {
  return <Testing {...settings} />;
};

export const onComponentRender = (hook, payload, actions) => {
  if (hook.if === "webcomponent" && payload.type === ComponentTypes.TESTING) {
    return [TestingPluginComponent];
  }
};
