Add a booking page, fetching data from the wordpress page
This commit is contained in:
1 parent
ab1c311333
commit
1be048c0f2
2 files changed
+41
-7
No files matched your search
@@ -152,13 +152,6 @@ exports.createPages = ({ actions, graphql }) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create the booking page
|
|
||||||
// const bookingTemplate = path.resolve(`./src/templates/booking.js`)
|
|
||||||
// createPage({
|
|
||||||
// path: `/booking/`,
|
|
||||||
// component: bookingTemplate,
|
|
||||||
// })
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return graphql(`
|
return graphql(`
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { graphql, useStaticQuery } from 'gatsby'
|
||||||
|
import Layout from '../components/Layout'
|
||||||
|
|
||||||
|
export const bookingPageQuery = graphql`
|
||||||
|
query BookingPage {
|
||||||
|
wordpressPage(slug: { eq: "booking" }) {
|
||||||
|
title
|
||||||
|
content
|
||||||
|
}
|
||||||
|
allWordpressWpVenues(
|
||||||
|
sort: { fields: date, order: DESC }
|
||||||
|
) {
|
||||||
|
totalCount
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
...VenueFields
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
export const BookingPage = () => {
|
||||||
|
const data = useStaticQuery(bookingPageQuery)
|
||||||
|
const { title, content } = data.wordpressPage
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<section className="page">
|
||||||
|
<h1 className="page-title">{title}</h1>
|
||||||
|
<div
|
||||||
|
className="page-content wp-content"
|
||||||
|
dangerouslySetInnerHTML={{ __html: content }}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BookingPage
|
||||||
Reference in new issue
Block a user