Skip to content

Commit

Permalink
feat(PageHelp): make PageHelp messages 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 265a831 commit 1e34332
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
5 changes: 4 additions & 1 deletion messages_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
]
}
],
"quadrantsPreDescription": "The quadrants are:",
"quadrants": [
{
"name": "Languages and Frameworks",
Expand All @@ -60,6 +61,7 @@
"description": "(including AOE internal Services): Here we include infrastructure platforms and services. We also use this category to communicate news about AOE services that we want all AOE teams to be aware of."
}
],
"ringsPreDescription": "Each of the items is classified in one of these rings:",
"rings": [
{
"name": "Adopt",
Expand All @@ -82,7 +84,8 @@
"href": "https://github.com/AOEpeople/aoe_technology_radar",
"name": "AOE Tech Radar on Github",
"description": "Contributions and source code of the AOE Tech Radar are on github:"
}
},
"headlinePrefix": "How to use the"
},
"pageOverview": {
"title": "Technologies Overview"
Expand Down
5 changes: 4 additions & 1 deletion public/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
]
}
],
"quadrantsPreDescription": "The quadrants are:",
"quadrants": [
{
"name": "Languages and Frameworks",
Expand All @@ -60,6 +61,7 @@
"description": "(including AOE internal Services): Here we include infrastructure platforms and services. We also use this category to communicate news about AOE services that we want all AOE teams to be aware of."
}
],
"ringsPreDescription": "Each of the items is classified in one of these rings:",
"rings": [
{
"name": "Adopt",
Expand All @@ -82,7 +84,8 @@
"href": "https://github.com/AOEpeople/aoe_technology_radar",
"name": "AOE Tech Radar on Github",
"description": "Contributions and source code of the AOE Tech Radar are on github:"
}
},
"headlinePrefix": "How to use the"
},
"pageOverview": {
"title": "Technologies Overview"
Expand Down
11 changes: 6 additions & 5 deletions src/components/PageHelp/PageHelp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ const PageHelp: React.FC<Props> = ({ leaving, onLeave }) => {
const { pageHelp } = useMessages();

if (pageHelp) {
const { paragraphs, quadrants, rings, sourcecodeLink } = pageHelp;
const { paragraphs, quadrants, rings, sourcecodeLink, headlinePrefix, quadrantsPreDescription, ringsPreDescription } = pageHelp;
const title = `${headlinePrefix || 'How to use the'} ${radarName}`;
return (
<Fadeable leaving={leaving} onLeave={onLeave}>
<SetTitle title={"How to use the " + radarName} />
<HeroHeadline>How to use the {radarName}</HeroHeadline>
<SetTitle title={title}/>
<HeroHeadline>{title}</HeroHeadline>
<div className="fullpage-content">
{paragraphs.map(({ headline, values }) => (
<React.Fragment key={headline}>
Expand All @@ -29,7 +30,7 @@ const PageHelp: React.FC<Props> = ({ leaving, onLeave }) => {
</React.Fragment>
))}

<p>The quadrants are:</p>
<p>{quadrantsPreDescription ?? "The quadrants are:"}</p>
<ul>
{quadrants.map(({ name, description }) => (
<li key={name}>
Expand All @@ -38,7 +39,7 @@ const PageHelp: React.FC<Props> = ({ leaving, onLeave }) => {
))}
</ul>

<p>Each of the items is classified in one of these rings:</p>
<p>{ringsPreDescription ?? "Each of the items is classified in one of these rings:"}</p>
<ul>
{rings.map(({ name, description }) => (
<li key={name}>
Expand Down
3 changes: 3 additions & 0 deletions src/context/MessagesContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ interface Paragraph {

interface PageHelp {
paragraphs: Paragraph[];
quadrantsPreDescription?: string;
quadrants: Quadrant[];
rings: Ring[];
ringsPreDescription?: string;
sourcecodeLink?: {
href: string;
name: string;
description: string;
};
headlinePrefix?: string
}

interface PageOverview {
Expand Down

0 comments on commit 1e34332

Please sign in to comment.