import React, { FC } from "react"
import PropTypes from "prop-types"
import { useStaticQuery, graphql } from "gatsby"

interface seoType {
    description: string,
    title   : string,
    children: React.ReactNode;
}

const SEO: FC<seoType> = (props) => {
  const { site } = useStaticQuery(
    graphql`
      query {
        site {
          siteMetadata {
            title
            description
            author
          }
        }
      }
    `
  )

  const metaDescription = props.description || site.siteMetadata.description

  return (
    <>
      <html lang="en" />
      <title>{props.title}</title>
      <meta name="description" content={metaDescription} />
      <meta property="og:title" content={props.title} />
      <meta property="og:description" content={metaDescription} />
      <meta property="og:type" content="website" />
      <meta name="twitter:creator" content={site.siteMetadata.author} /> 
      <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
      <script async src="https://anal.nochill.in/script.js" data-website-id="33946759-3b3c-4f30-843e-abd8b437efd3"></script>
      {props.children}
    </>
  )
}

export default SEO