import React from 'react' import '../src/globalStyles.css' import data from '../src/data.json' import Home from '../src/views/Home' import About from '../src/views/About' import Contact from '../src/views/Contact' import Blog from '../src/views/Blog' import SinglePost from '../src/views/SinglePost' console.log('React version', React.version) const CMS = window.CMS CMS.registerPreviewStyle( 'https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.css' ) CMS.registerPreviewStyle('/admin/cms.bundle.css') const getDocument = (collection, name) => data[collection] && data[collection].filter(page => page.name === name)[0] const getDocuments = (collection, name) => data[collection] const globalSettings = getDocument('settings', 'global') const posts = getDocuments('posts') // Preview Templates CMS.registerPreviewTemplate('home-page', ({ entry }) => ( )) CMS.registerPreviewTemplate('about-page', ({ entry }) => ( )) CMS.registerPreviewTemplate('contact-page', ({ entry }) => ( )) CMS.registerPreviewTemplate('blog-page', ({ entry }) => ( )) CMS.registerPreviewTemplate('posts', ({ entry }) => ( )) // Return to home when user logging out window.netlifyIdentity.on('logout', function () { document.location.href = '/' }) // Log netlifySiteURL if editing on localhost if ( window.location.hostname === 'localhost' && window.localStorage.getItem('netlifySiteURL') ) { console.log( `%cnetlifySiteURL: ${window.localStorage.getItem('netlifySiteURL')}`, 'color: hotpink; font-size: 15px' ) }