Commit 6c9f7f3c authored by Jon Moore's avatar Jon Moore
Browse files

Merge branch 'master' into workshop-opgb

parents 34d0974d 51f1ce1f
Pipeline #39501 passed with stage
in 6 minutes and 19 seconds
......@@ -5,6 +5,7 @@ const BlogListingStyled = styled.div`
return css`
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
max-width: 1200px;
margin: 30px auto;
......@@ -18,23 +19,12 @@ const BlogListingStyled = styled.div`
margin: 20px;
@media only screen and (min-width: 550px) {
margin: 0;
margin-right: 28px;
width: calc(50% - 15px);
&:nth-child(2n) {
margin-right: 0;
}
}
@media only screen and (min-width: 1100px) {
margin: 0;
margin-right: 28px;
width: calc(33% - 15px);
&:nth-child(2n) {
margin-right: 28px;
}
&:nth-child(3n) {
margin-right: 0;
}
}
p {
......
......@@ -12,13 +12,18 @@ import BlogCard from './BlogCard';
const fetchEntries = async versionStatus => {
const triggerSearch = async versionStatus => {
try {
//DELIVERY API QUERY START//
let query = new Query(
Op.equalTo('sys.contentTypeId', 'blogPost'),
Op.equalTo('sys.versionStatus', versionStatus)
);
query.pageSize = 3;
query.fields = ['title', 'summary', 'image', 'sys'];
//DELIVERY API QUERY END//
//DELIVERY API SEARCH START//
return await cachedSearch.search(query, 1);
//DELIVERY API SEARCH END//
} catch (error) {
throw new Error(error);
}
......@@ -29,6 +34,7 @@ const fetchEntries = async versionStatus => {
const BlogListing = ({ className }) => {
const [results, setResults] = useState();
//GET VERSION STATUS
const versionStatus = useSelector(selectVersionStatus);
//const versionStatus = 'latest';
useEffect(() => {
......@@ -39,6 +45,7 @@ const BlogListing = ({ className }) => {
let resultsInfo = null;
//DELIVERY API PAGING INFO START//
if (results && results.totalCount > 0) {
const start = results.pageIndex * results.pageSize + 1;
let end = results.pageSize;
......@@ -46,6 +53,7 @@ const BlogListing = ({ className }) => {
resultsInfo = `Displaying ${start}-${end} of ${results.totalCount} results`;
}
//DELIVERY API PAGING INFO END//
return (
<BlogListingStyled className={className}>
......@@ -56,6 +64,7 @@ const BlogListing = ({ className }) => {
/>
)}
{/* DELIVERY API RENDER ENTRIES START */}
{results &&
results.items &&
results.items.map((entry, idx) => {
......@@ -70,6 +79,7 @@ const BlogListing = ({ className }) => {
);
})}
{!results || (results.length < 1 && <p>No results found.</p>)}
{/* DELIVERY API RENDER ENTRIES END */}
</BlogListingStyled>
);
};
......
......@@ -13,13 +13,18 @@ import EventCard from './EventCard';
const fetchEntries = async versionStatus => {
const triggerSearch = async versionStatus => {
try {
//DELIVERY API QUERY START//
let query = new Query(
Op.equalTo('sys.contentTypeId', 'blogPost'),
Op.equalTo('sys.versionStatus', versionStatus)
);
query.pageSize = 3;
query.fields = ['title', 'summary', 'image', 'sys'];
//DELIVERY API QUERY END//
//DELIVERY API SEARCH START//
return await cachedSearch.search(query, 1);
//DELIVERY API SEARCH END//
} catch (error) {
throw new Error(error);
}
......@@ -30,6 +35,7 @@ const fetchEntries = async versionStatus => {
const EventListing = ({ className }) => {
const [results, setResults] = useState();
//GET VERSION STATUS
const versionStatus = useSelector(selectVersionStatus);
//const versionStatus = 'latest';
useEffect(() => {
......@@ -40,6 +46,7 @@ const EventListing = ({ className }) => {
let resultsInfo = null;
//DELIVERY API PAGING INFO START//
if (results && results.totalCount > 0) {
const start = results.pageIndex * results.pageSize + 1;
let end = results.pageSize;
......@@ -47,6 +54,7 @@ const EventListing = ({ className }) => {
resultsInfo = `Displaying ${start}-${end} of ${results.totalCount} results`;
}
//DELIVERY API PAGING INFO END//
return (
<EventsListingStyled className={className}>
......@@ -57,6 +65,7 @@ const EventListing = ({ className }) => {
/>
)}
{/* DELIVERY API RENDER ENTRIES START */}
{results && results.items && (
<ul>
{results.items.map((entry, idx) => {
......@@ -65,6 +74,7 @@ const EventListing = ({ className }) => {
</ul>
)}
{!results || (results.length < 1 && <p>No results found.</p>)}
{/* DELIVERY API RENDER ENTRIES END */}
</EventsListingStyled>
);
};
......
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