Commit b53fc57c authored by David Rhoderick's avatar David Rhoderick
Browse files

Adding object custom post type and object

of the day data to home page component.
parent 11d18d88
......@@ -18,7 +18,12 @@ const settings = {
state: {
source: {
homepage: '/marthas-vineyard-museum',
url: 'http://staging.mvmuseum.org'
url: 'http://staging.mvmuseum.org',
postTypes: [{
type: 'object',
endpoint: 'object',
archive: '/objects'
}]
}
}
},
......
import React from "react";
import { connect } from "frontity";
import Switch from "@frontity/components/switch";
import React, {useEffect} from 'react'
import { connect } from 'frontity'
import Switch from '@frontity/components/switch'
import HeroSlideshow from "./home/hero-slideshow";
import Hours from "./home/hours";
import LinksContainer from "./home/linksContainer";
const Home = ({ state }) => {
const Home = ({ state, actions }) => {
const data = state.source.get(state.router.link);
const post = state.source[data.type][data.id];
console.log(post.acf.hours);
const text = {
title: "titlellee",
description: "opis",
};
console.log(post.acf.quick_links);
// For each of Upcoming Event, Current Exhibition, and Object of the day,
const objectOfTheDayLink = `/${post.acf.object_of_the_day.post_type}/${post.acf.object_of_the_day.post_name}`
useEffect(() => {
actions.source.fetch(objectOfTheDayLink)
}, [])
const objectOfTheDayData = state.source.get(objectOfTheDayLink)
return (
<>
......@@ -25,12 +30,8 @@ const Home = ({ state }) => {
<Hours hours={post.acf.hours} />
<LinksContainer quick_links={post.acf.quick_links} />
{/* {post.acf.content.map((section, index) =>
<Switch key={index}>
<Testimonials when={section.acf_fc_layout === 'testimonials'} section={section} />
</Switch>
)} */}
<pre style={{ zIndex: 100, position: "relative" }}>{(objectOfTheDayData.isReady) && state.source.attachment[state.source[post.acf.object_of_the_day.post_type][post.acf.object_of_the_day.ID].featured_media].source_url}</pre>
</>
);
};
......
......@@ -101,10 +101,10 @@ export default {
theme: {
colors: themeColors,
breakPoints: {
sm: `@media (max-width: 576px)`,
md: `@media (max-width: 768px)`,
lg: `@media (max-width: 992px)`,
xl: `@media (max-width: 1200px)`,
sm: `@media (max-width: 576px)`,
md: `@media (max-width: 768px)`,
lg: `@media (max-width: 992px)`,
xl: `@media (max-width: 1200px)`,
xxl: `@media (min-width: 1400px)`
},
buttonStyle: buttonStyle,
......@@ -145,11 +145,12 @@ export default {
},
actions: {
theme: {
beforeSSR: async ({ libraries, actions }) => {
beforeSSR: async ({ actions }) => {
await actions.source.fetch('/menus/primary-menu')
// await actions.source.fetch('/menus/footer-menu')
await actions.source.fetch('acf-options-page')
await actions.source.fetch('nameAndDescription')
await actions.source.fetch('/objects')
}
}
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment