'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var Head = require('next/head');
var urlFor = require('@mjhls/mjh-framework/dist/cjs/urlFor');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
var urlFor__default = /*#__PURE__*/_interopDefaultLegacy(urlFor);

var Header = function Header(props) {
  var title = props.title,
      keyword = props.keyword,
      description = props.description,
      isLiveSite = props.isLiveSite,
      canonicalUrl = props.canonicalUrl,
      addOpenGraph = props.addOpenGraph,
      docGroup = props.docGroup,
      client = props.client;


  return addOpenGraph && docGroup ? React__default["default"].createElement(
    Head__default["default"],
    null,
    title && React__default["default"].createElement(
      'title',
      null,
      title
    ),
    keyword && React__default["default"].createElement('meta', { name: 'keywords', content: keyword }),
    description && React__default["default"].createElement('meta', { name: 'description', content: description, key: 'description' }),
    !isLiveSite && React__default["default"].createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
    canonicalUrl && React__default["default"].createElement('link', { rel: 'canonical', href: canonicalUrl, key: 'canonical' }),
    React__default["default"].createElement('meta', { name: 'twitter:card', content: 'summary' }),
    React__default["default"].createElement('meta', { name: 'twitter:title', content: docGroup.name }),
    React__default["default"].createElement('meta', { name: 'twitter:site', content: '@cancernetwrk' }),
    React__default["default"].createElement('meta', { name: 'twitter:image', content: urlFor__default["default"]({ client: client, source: docGroup.thumbnail, imageHeight: 630, imageWidth: 1200, imageMaxHeight: null, imageFit: null }) }),
    React__default["default"].createElement('meta', { name: 'twitter:description', content: docGroup.description[0].children[0].text }),
    React__default["default"].createElement('meta', { property: 'og:title', content: docGroup.name }),
    React__default["default"].createElement('meta', { property: 'og:site_name', content: 'Cancer Network' }),
    React__default["default"].createElement('meta', { property: 'og:url', content: 'https://www.cancernetwork.com' + props.url }),
    React__default["default"].createElement('meta', { property: 'og:image', content: urlFor__default["default"]({ client: client, source: docGroup.thumbnail, imageHeight: 630, imageWidth: 1200, imageMaxHeight: null, imageFit: null }) })
  ) : React__default["default"].createElement(
    Head__default["default"],
    null,
    title && React__default["default"].createElement(
      'title',
      null,
      title
    ),
    keyword && React__default["default"].createElement('meta', { name: 'keywords', content: keyword }),
    description && React__default["default"].createElement('meta', { name: 'description', content: description, key: 'description' }),
    !isLiveSite && React__default["default"].createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
    canonicalUrl && React__default["default"].createElement('link', { rel: 'canonical', href: canonicalUrl, key: 'canonical' })
  );
};

var Header$1 = React__default["default"].memo(Header);

exports.Header = Header;
exports["default"] = Header$1;
