Skip to content

Commit

Permalink
feat(PageIndex): make PageIndex published text configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
d-koppenhagen authored and bastianccm committed Nov 10, 2021
1 parent a509e0a commit 265a831
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions messages_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"pageItem": {
"quadrantOverview": "Quadrant Overview"
},
"pageIndex": {
"publishedLabel": "Quadrant Overview"
},
"legalInformationLink": "https://www.aoe.com/en/imprint.html",
"search": "What are you looking for?"
}
3 changes: 3 additions & 0 deletions public/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"pageItem": {
"quadrantOverview": "Quadrant Overview"
},
"pageIndex": {
"publishedLabel": "Quadrant Overview"
},
"legalInformationLink": "https://www.aoe.com/en/imprint.html",
"search": "What are you looking for?"
}
6 changes: 5 additions & 1 deletion src/components/PageIndex/PageIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Fadeable from "../Fadeable/Fadeable";
import SetTitle from "../SetTitle";
import { radarName, radarNameShort } from "../../config";
import { MomentInput } from "moment";
import { useMessages } from "../../context/MessagesContext";

type PageIndexProps = {
leaving: boolean;
Expand All @@ -21,6 +22,9 @@ export default function PageIndex({
items,
releases,
}: PageIndexProps) {
const { pageIndex } = useMessages();
const publishedLabel = pageIndex?.publishedLabel || 'Published';

const newestRelease = releases.slice(-1)[0];
const numberOfReleases = releases.length;
return (
Expand All @@ -33,7 +37,7 @@ export default function PageIndex({
</div>
<QuadrantGrid items={featuredOnly(items)} />
<div className="publish-date">
Published {formatRelease(newestRelease)}
{publishedLabel} {formatRelease(newestRelease)}
</div>
</Fadeable>
);
Expand Down
5 changes: 5 additions & 0 deletions src/context/MessagesContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ interface PageItem {
quadrantOverview: string;
}

interface PageIndex {
publishedLabel: string;
}

export interface Messages {
footerFootnote?: string;
socialLinks?: SocialLink[];
legalInformationLink?: string;
pageHelp?: PageHelp;
pageOverview?: PageOverview;
pageItem?: PageItem;
pageIndex?: PageIndex;
searchPlaceholder?: string;
}

Expand Down

0 comments on commit 265a831

Please sign in to comment.