Extract AOE specific texts as messages.json

This commit is contained in:
dennis.ludwig
2021-07-01 13:36:10 +02:00
parent ab72666052
commit 72861c0066
9 changed files with 292 additions and 227 deletions

View File

@@ -1,5 +1,5 @@
import { createContext, FC, useContext } from "react";
import { Props as SocialIcon } from "../../components/SocialIcon/SocialIcon";
import { Props as SocialLink } from "../../components/SocialLink/SocialLink";
interface Quadrant {
name: string;
@@ -11,24 +11,32 @@ interface Ring {
description: string;
}
interface Paragraph {
headline: string;
values: string[];
}
interface PageHelp {
introduction: string[];
whatIsTheRadar: string[];
howItIsCreated: string[];
howShouldItBeUsed: string[];
paragraphs: Paragraph[];
quadrants: Quadrant[];
rings: Ring[];
sourcecodeLink?: {
href: string;
name: string;
description: string;
};
}
export interface Messages {
footerFootnote: string;
socialIcons: SocialIcon[];
pageHelp: PageHelp;
footerFootnote?: string;
socialLinks?: SocialLink[];
legalInformationLink?: string;
pageHelp?: PageHelp;
}
const MessagesContext = createContext<Messages | undefined>(undefined);
export const MessagesProvider: FC<{ messages: Messages }> = ({
export const MessagesProvider: FC<{ messages?: Messages }> = ({
messages,
children,
}) => (
@@ -42,5 +50,5 @@ export const useMessages = () => {
if (context === undefined) {
throw new Error("useMessages must be used within a MessagesProvider");
}
return context;
return context || {};
};