Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIGG-160-beta: Updating preamble on hero #182

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pages/goda-exempel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export const getStaticProps: GetStaticProps = async ({ locale }) => {
seo: {
...populateSeo,
title: "Goda exempel - Sveriges Dataportal",
description: "Inspirerande exempel relaterat till Data & API:er.",
description: "Goda exempel på datadriven innovation i samhället.",
},
basePath: `/goda-exempel`,
heading: "Goda exempel",
preamble: "Goda exempel på datadriven innovation i samhället.",
heroImage: renderImage({
src: "/images/goodExamplesHero.png",
width: 1700,
Expand Down
1 change: 1 addition & 0 deletions pages/nyheter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const getStaticProps: GetStaticProps = async ({ locale }) => {
},
basePath: `/nyheter`,
heading: "Nyheter",
preamble: "Nyheter för Sveriges Dataportal",
heroImage: renderImage({
src: "/images/newsHero.png",
width: 1700,
Expand Down
8 changes: 7 additions & 1 deletion utilities/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ type ResolvedPage = {
export const resolvePage = (props: DataportalPageProps): ResolvedPage => {
switch (props.type) {
case "RootAggregate":
return { seo: props.seo, heroImage: props.image, heading: props.heading };
return {
seo: props.seo,
heroImage: props.image,
heading: props.heading,
preamble: props.preamble,
};
case "DomainAggregate":
return { seo: props.seo, heroImage: props.image, heading: props.heading };
case "MultiContainer":
Expand All @@ -60,6 +65,7 @@ export const resolvePage = (props: DataportalPageProps): ResolvedPage => {
seo: props.seo,
heading: props.heading,
heroImage: props.heroImage,
preamble: props.preamble,
};
case "Form":
return {};
Expand Down
5 changes: 4 additions & 1 deletion utilities/queryHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export interface PublicationListResponse {
seo?: SeoDataFragment;
basePath?: string;
heading?: string;
preamble?: string;
heroImage?: ImageFragment | null;
}

Expand Down Expand Up @@ -231,6 +232,7 @@ export interface PublicationListOptions {
seo?: SeoDataFragment;
basePath?: string;
heading?: string;
preamble?: string;
heroImage?: ImageFragment | null;
}

Expand Down Expand Up @@ -352,7 +354,7 @@ export const getPublicationsList = async (
) => {
// If nextjs should check for changes on the server
const revalidate = true;
const { seo, basePath, heading, heroImage } = opts || {};
const { seo, basePath, heading, preamble, heroImage } = opts || {};

try {
const { data, error } = await client.query<
Expand Down Expand Up @@ -394,6 +396,7 @@ export const getPublicationsList = async (
seo: seo || null,
basePath: basePath || null,
heading: heading || null,
preamble: preamble || null,
heroImage: heroImage || null,
} as PublicationListResponse,
...(revalidate
Expand Down