diff --git a/src/queries/careerPathwaysPage.ts b/src/queries/careerPathwaysPage.ts index 895df207b..59b6a7617 100644 --- a/src/queries/careerPathwaysPage.ts +++ b/src/queries/careerPathwaysPage.ts @@ -1,3 +1,5 @@ +import { fragments } from "./commonQueries"; + export const CAREER_PATHWAYS_PAGE_QUERY = `query Pathways { page: careerPathwaysPage(id: "2bNH2ey6qkohbjnllmwSzg") { sys { @@ -29,4 +31,7 @@ export const CAREER_PATHWAYS_PAGE_QUERY = `query Pathways { } } } + ${fragments.pageBanner} +${fragments.iconCard} +${fragments.linkObject} `; diff --git a/src/queries/commonQueries.ts b/src/queries/commonQueries.ts new file mode 100644 index 000000000..3c615b518 --- /dev/null +++ b/src/queries/commonQueries.ts @@ -0,0 +1,99 @@ +export const richText = `json +links { + assets { + block { + sys { + id + } + url + title + description + width + height + contentType + } + } +}`; + +export const navItems = `footerNav1: navMenus(id: "6QDRPQOaswzG5gHPgqoOkS") { + navItems +} +footerNav2: navMenus(id: "3WHbfXiLFSBXRC24QCq8H6") { + navItems +} +globalNav: navMenus(id: "7ARTjtRYG7ctcjPd1nbCHr") { + navItems +} +mainNav: navMenus(id: ${ + process.env.REACT_APP_FEATURE_CAREER_PATHWAYS === "true" + ? '"6z5HiOP5HqvJc07FURpT8Z"' + : '"3jcP5Uz9OY7syy4zu9Viul"' +}) { + navItems +}`; + +export const metadata = ` +title +pageDescription +keywords +ogImage { + sys { + id + } + url + title + width + height + fileName + contentType +} +`; + +export const fragments = { + pageBanner: `fragment PageBanner on PageBanner { + title + section + breadcrumbsCollection(limit: 10) { + items { + sys { + id + } + copy + url + } + } + message { + json + } + ctaHeading + ctaLinksCollection(limit: 2) { + items { + sys { + id + } + copy + url + } + } + }`, + linkObject: `fragment LinkObject on LinkObject{ + sys { + id + } + copy + screenReaderOnlyCopy + url + icon + customSvg + description + }`, + iconCard: `fragment IconCard on IconCard { + sys { + id + } + heading + icon + description + sectionIcon + }`, +}; diff --git a/src/queries/fragments.ts b/src/queries/fragments.ts new file mode 100644 index 000000000..98247da7d --- /dev/null +++ b/src/queries/fragments.ts @@ -0,0 +1,75 @@ +import { richText } from "./commonQueries"; + +export const fragments = { + pageBanner: `fragment PageBanner on PageBanner { + title + section + breadcrumbsCollection { + items { + sys { + id + } + copy + url + } + } + message { + ${richText} + } + ctaHeading + ctaLinksCollection { + items { + sys { + id + } + copy + url + } + } + }`, + linkObject: `fragment LinkObject on LinkObject{ + sys { + id + } + copy + screenReaderOnlyCopy + url + icon + customSvg + description + }`, + iconCard: `fragment IconCard on IconCard { + sys { + id + } + title: heading + icon + description + sectionIcon + }`, +}; + +export const NavMenuFields = ` +heading +url +topLevelItemsCollection { + items { + sys { + id + } + copy + screenReaderOnlyCopy + classes + url + subItemsCollection { + items { + sys { + id + } + copy + url + } + } + } +} +`;