Skip to content

Commit

Permalink
[C] integrate sidebar to main page template
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed Jul 18, 2024
1 parent 5f9f82c commit d46fc9b
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 255 deletions.
65 changes: 0 additions & 65 deletions components/dynamic/DataProductsList/index.js

This file was deleted.

88 changes: 0 additions & 88 deletions components/templates/DataProductPage/index.js

This file was deleted.

11 changes: 11 additions & 0 deletions components/templates/Page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import GuideNavigation from "@/components/layout/GuideNavigation";
import SiblingNavigation from "@/components/layout/SiblingNavigation";
import NestedContext from "@/contexts/Nested";
import PageContent from "@/page/PageContent";
import MediaAside from "@/components/page/Aside/patterns/Media";
import { FilterParamsProvider } from "@/contexts/FilterParams";

export default function Page({
Expand All @@ -43,6 +44,8 @@ export default function Page({
subHeroColorScheme,
parent,
showGuideNav,
showSidebar,
sidebarAssets = [],
investigation,
siblings,
childNavigation,
Expand Down Expand Up @@ -143,6 +146,14 @@ export default function Page({
<PageContent
heroImage={!showSiblingNav && hero}
overlapHero={showSiblingNav ? false : shouldOverlapHero}
sidebar={
showSidebar && (
<MediaAside
manualAssets={sidebarAssets}
contentBlockAssets={contentBlocks}
/>
)
}
{...{ focalPointX, focalPointY }}
>
<SubHero
Expand Down
9 changes: 0 additions & 9 deletions lib/api/entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { glossaryTermFragment } from "@/lib/api/fragments/glossary-term";
import { studentPageFragment } from "./fragments/student-page";
import { educatorPageFragment } from "./fragments/educator-page";
import { investigationLandingPageFragment } from "./fragments/investigation-landing-page";
import { dataProductFragment } from "@/lib/api/fragments/data-product";

function dataListQueryify(fragment) {
return gql`
Expand Down Expand Up @@ -228,14 +227,6 @@ export function useDataList({
${dataListQueryify(`...slideshowFragment`)}
`;
break;
case "dataProducts":
theSection = section;
theOrderBy = "dateCreated desc";
query = gql`
${dataProductFragment}
${dataListQueryify(`...dataProductFragment`)}
`;
break;
default: // find a way to pass just news and pages
theSection = null;
theOrderBy = "dateUpdated desc";
Expand Down
11 changes: 0 additions & 11 deletions lib/api/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { glossaryTermFragmentFull } from "./fragments/glossary-term";
import { studentPageFragmentFull } from "./fragments/student-page";
import { educatorPageFragmentFull } from "./fragments/educator-page";
import { investigationLandingPageFragmentFull } from "./fragments/investigation-landing-page";
import { dataProductFragmentFull } from "@/lib/api/fragments/data-product";
import { addRelatedInvestigation } from "./investigation";
import { addSiblings } from "./sibling-nav";

Expand Down Expand Up @@ -161,14 +160,6 @@ function getQueryFragments(uri, section, type, site) {
${entryQueryify(`...searchFragmentFull`)}
`;
break;
case "dataProducts":
query = gql`
${linkFragment}
${allPageBlocksFragment}
${dataProductFragmentFull}
${entryQueryify(`...dataProductFragmentFull`)}
`;
break;
default:
query = gql`
${linkFragment}
Expand All @@ -177,7 +168,6 @@ function getQueryFragments(uri, section, type, site) {
${eventFragmentFull}
${homepageFragmentFull}
${newsPostFragmentFull}
${dataProductFragmentFull}
${pageFragmentFull}
${studentPageFragmentFull}
${searchFragmentFull}
Expand All @@ -191,7 +181,6 @@ function getQueryFragments(uri, section, type, site) {
...eventFragmentFull
...homepageFragmentFull
...newsPostFragmentFull
...dataProductFragmentFull
...pageFragmentFull
...studentPageFragmentFull
...educatorPageFragmentFull
Expand Down
80 changes: 0 additions & 80 deletions lib/api/fragments/data-product.js

This file was deleted.

44 changes: 44 additions & 0 deletions lib/api/fragments/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ export const pageFragment = `
${getImageFields("crop", 900, 550)}
}
}
sidebarAssets {
... on sidebarAssets_textLink_BlockType {
text
textLink {
url
}
}
}
}
}
`;
Expand Down Expand Up @@ -42,6 +50,42 @@ fragment pageFragmentFull on pages_pages_Entry {
${getImageFields("crop", 800, 600)}
}
}
showSidebar
sidebarAssets {
... on sidebarAssets_header_BlockType {
assetHeader
}
... on sidebarAssets_textLink_BlockType {
text
textLink {
url
}
}
... on sidebarAssets_externalLink_BlockType {
text
externalLink
}
... on sidebarAssets_image_BlockType {
image {
... on contentImages_Asset {
${getImageFields("crop", 900, 550)}
}
}
caption
}
... on sidebarAssets_galleryItem_BlockType {
galleryItem {
uri
... on galleryItems_galleryItem_Entry {
representativeAssetVariant {
... on assetVariants_Asset {
${getImageFields("crop", 900, 550)}
}
}
}
}
}
}
ancestors {
... on pages_pages_Entry {
id
Expand Down
Loading

0 comments on commit d46fc9b

Please sign in to comment.