Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Artlytical Media
Marthas Vineyard Museum Frontity
Commits
b53fc57c
Commit
b53fc57c
authored
Jan 21, 2021
by
David Rhoderick
Browse files
Adding object custom post type and object
of the day data to home page component.
parent
11d18d88
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontity.settings.js
View file @
b53fc57c
...
...
@@ -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
'
}]
}
}
},
...
...
packages/mvmuseum-theme/src/components/home.js
View file @
b53fc57c
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
>
<
/
>
);
};
...
...
packages/mvmuseum-theme/src/index.js
View file @
b53fc57c
...
...
@@ -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
'
)
}
}
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment