text: import { useState, useEffect, useRef } from "react";
  import Link from "next/link";
  import Head from "next/head";
  import css_content from '../css/home.module.css';
  import { getContent, getListings } from "../utils/getListings";
  import ContentPageHeader from "../components/ContentPageHeader";
  //import {RichText} from 'prismic-reactjs';
  import RichText from '../components/RichText';
  import Menu from "../components/Menu";
  import Footer from "../components/Footer";
  
  export default (props) => {
  
      const [ content, setContent ] = useState(props.content);
      console.log('cotnent', content);
      let query = {};
      if (typeof window !== "undefined") {
          let params = (window.location.search || "")
              .substr(1)
              .split("&")
              .forEach((pair) => {
                  var spl = pair.split("=");
                  query[decodeURIComponent(spl[0])] = decodeURIComponent(spl[1]);
              });
          console.log("props", props, "query", query);
  
          if (query.preview) {
              console.log('execute preview ref_id', query.preview)
              useEffect(
                  () => {
                      getData({preview: query.preview}).then(get_content => {
                          setContent(get_content);
                          console.log('updated content', get_content, content)
                      });
                  },
                  [ ]
              );
          }
      }
  
  
      if (typeof window !== 'undefined') {
          console.log('props', props)
      }
  
      return (
          <div>
              <Head>
                  <title>{content.page_title} - Spicy Green Book</title>
                  {content.description && 
                      <meta
                      name="description"
                      content={content.description}
                      key="description"
                      />
                  }
                  {content.description && 
                      <meta
                      name="og:description"
                      content={content.description}
                      key="og:description"
                      />
                  }
                  <meta property="og:title" content={content.page_title + " - Spicy Green Book"} key="title" />
                  <meta property="og:url" content={"https://spicygreenbook.com/" + content.uid } key="og:url" />
              </Head>
              <header>
                  <Menu mode="content" />
              </header>
              <div id="page">
                  <ContentPageHeader />
                  <div className="content" style={{padding: '40px 20px'}}>
                      <h1>{content.page_title}</h1>
                      <RichText render={content._body.value} />
  
                      <h3>Contact Form</h3>
                      <div className="hb-p-5f0282b0a1f62a61eedd0881-2" style={{display: 'inline-block', maxWidth: '100%', minWidth: 600, boxSizing: 'border-box'}}/>
                      <img height="1" width="1" style={{display:'none'}} src="https://www.honeybook.com/p.png?pid=5f0282b0a1f62a61eedd0881" />
                      <script
                      dangerouslySetInnerHTML={{
                          __html: `
                        (function(h,b,s,n,i,p,e,t) {
                          h._HB_ = h._HB_ || {};h._HB_.pid = i;;;;
                          t=b.createElement(s);t.type="text/javascript";t.async=!0;t.src=n;
                          e=b.getElementsByTagName(s)[0];e.parentNode.insertBefore(t,e);
                      })(window,document,"script","https://widget.honeybook.com/assets_users_production/websiteplacements/placement-controller.min.js","5f0282b0a1f62a61eedd0881");
                          `}} />
                  </div>
                  <Footer />
              </div>
          </div>
      );
  };
  
  async function getData(config) {
      if (!config) { config = {}; }
      console.log('config get data after load', config)
      let content = await getContent({type: 'content', uid: 'contact', ref_id: config.preview || ''});
      return content.content
  }
  
  export async function getStaticProps(context) {
  
      let content = await getData(context);
  
      return {
          props: {
              content: content
          },
      };
  }
  
  
  // This is a test comment 
  