import React from "react";
import Helmet from "react-helmet";
import { get } from "lodash";

export const SEOComponent: React.FC<{
  seoPayload: any;
}> = ({ seoPayload }) => {
  const parsedPayload = JSON.parse(unescape(seoPayload));
  return (
    <Helmet
      title={unescape(get(parsedPayload, "title", ""))}
      meta={[
        { name: "description", content: get(parsedPayload, "description", "") },
        { name: "keywords", content: get(parsedPayload, "keywords", "") },
      ]}
    />
  );
};

export default SEOComponent;
