Skip to content

Commit

Permalink
feat(PageItem): make PageItem back to quadrant overview text configur…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
d-koppenhagen authored and bastianccm committed Nov 10, 2021
1 parent 0e180cc commit a509e0a
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 @@ -87,6 +87,9 @@
"pageOverview": {
"title": "Technologies Overview"
},
"pageItem": {
"quadrantOverview": "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 @@ -87,6 +87,9 @@
"pageOverview": {
"title": "Technologies Overview"
},
"pageItem": {
"quadrantOverview": "Quadrant Overview"
},
"legalInformationLink": "https://www.aoe.com/en/imprint.html",
"search": "What are you looking for?"
}
6 changes: 5 additions & 1 deletion src/components/PageItem/PageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
groupByQuadrants,
Item,
} from "../../model";
import { useMessages } from "../../context/MessagesContext";

const getItem = (pageName: string, items: Item[]) => {
const [quadrantName, itemName] = pageName.split("/");
Expand All @@ -33,6 +34,9 @@ type Props = {
};

const PageItem: React.FC<Props> = ({ pageName, items, leaving, onLeave }) => {
const { pageItem } = useMessages();
const quadrantOverview = pageItem?.quadrantOverview || 'Quadrant Overview';

const itemsInRing = getItemsInRing(pageName, items);

const { getAnimationState, getAnimationStates } = useAnimations({
Expand Down Expand Up @@ -70,7 +74,7 @@ const PageItem: React.FC<Props> = ({ pageName, items, leaving, onLeave }) => {
<div className="split__right">
<Link className="icon-link" pageName={item.quadrant}>
<span className="icon icon--pie icon-link__icon" />
Quadrant Overview
{quadrantOverview}
</Link>
</div>
</div>
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 @@ -31,12 +31,17 @@ interface PageOverview {
title: string;
}

interface PageItem {
quadrantOverview: string;
}

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

Expand Down

0 comments on commit a509e0a

Please sign in to comment.