Skip to content

Commit f66c495

Browse files
committed
refactor(AdditionalResources): streamline component and update localization strings
1 parent 1c71858 commit f66c495

File tree

4 files changed

+42
-99
lines changed

4 files changed

+42
-99
lines changed

components/AdditionalResources/AdditionalResources.tsx

Lines changed: 36 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,46 @@
11
import { Container } from "react-bootstrap"
2-
import AdditionalResourcesCard from "./AdditionalResourcesCard"
3-
import AdditionalResourcesCardContent from "./AdditionalResourcesCardContent"
2+
import { useTranslation, Trans } from "next-i18next"
3+
import * as links from "components/links"
44

5-
const content = [
6-
{
7-
paragraph: {
8-
P1: (
9-
<>
10-
The MA Legislature has an{" "}
11-
<a
12-
href="https://malegislature.gov/Search/FindMyLegislator"
13-
target="_blank"
14-
rel="noopener noreferrer"
15-
>
16-
online tool
17-
</a>{" "}
18-
you can use to identify your legislators based on your home address.
19-
</>
20-
)
21-
}
22-
},
23-
{
24-
paragraph: {
25-
P1: (
26-
<>
27-
The MA Legislature publishes a{" "}
28-
<a
29-
href="https://www.mass.gov/doc/the-legislative-process-0/download"
30-
target="_blank"
31-
rel="noopener noreferrer"
32-
>
33-
document on the legislative process.
34-
</a>
35-
</>
36-
)
37-
}
38-
},
39-
{
40-
paragraph: {
41-
P1: (
42-
<>
43-
Mass Legal Services published a 2007 guide to The{" "}
44-
<a
45-
href="https://www.masslegalservices.org/content/legislative-process-massachusetts-0"
46-
target="_blank"
47-
rel="noopener noreferrer"
48-
>
49-
Legislative Process in Massachusetts.
50-
</a>
51-
</>
52-
)
5+
const AdditionalResources = () => {
6+
const content = [
7+
{
8+
i18nKey: "find_legislator",
9+
href: "https://malegislature.gov/Search/FindMyLegislator"
10+
},
11+
{
12+
i18nKey: "legislative_doc",
13+
href: "https://www.mass.gov/doc/the-legislative-process-0/download"
14+
},
15+
{
16+
i18nKey: "legal_services",
17+
href: "https://www.masslegalservices.org/content/legislative-process-massachusetts-0"
5318
}
54-
}
55-
]
19+
]
20+
const { t } = useTranslation("learnComponents")
5621

57-
const AdditionalResources = () => {
5822
return (
5923
<Container fluid="md" className="mt-3">
60-
<h1 className={`fs-1 fw-bold text-center text-black`}>
61-
Additional Resources
24+
<h1 className="fs-1 fw-bold text-center text-black">
25+
{t("legislative.additional_resources")}
6226
</h1>
63-
<p className={`fs-4 mx-5 my-3`}>
64-
We hope these pages will help you submit effective testimony. You may
65-
want to consult these other resources to build a more detailed
66-
understanding of the legislative process and how you can contribute.
67-
</p>
68-
{content.map((value, index) => (
69-
<AdditionalResourcesCard key={index}>
70-
<AdditionalResourcesCardContent key={index}>
71-
{value.paragraph.P1}
72-
</AdditionalResourcesCardContent>
73-
</AdditionalResourcesCard>
27+
<p className="fs-4 mx-5 my-3">{t("legislative.resources_intro")}</p>
28+
29+
{content.map(({ i18nKey, href }) => (
30+
<div
31+
key={i18nKey}
32+
className="m-4 py-2 px-4 text-bg-light rounded-4 d-flex align-items-center align-items-sm-start"
33+
>
34+
<div className="d-flex flex-0 justify-content-xs-center p-4">
35+
<p className="fs-4">
36+
<Trans
37+
t={t}
38+
i18nKey={`legislative.${i18nKey}`}
39+
components={[<links.External href={href} />]}
40+
/>
41+
</p>
42+
</div>
43+
</div>
7444
))}
7545
</Container>
7646
)

components/AdditionalResources/AdditionalResourcesCard.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

components/AdditionalResources/AdditionalResourcesCardContent.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

public/locales/en/learnComponents.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@
123123
"title": "Executive Branch",
124124
"paragraph": "Lastly, the Governor is responsible for signing the enacted and reconciled bill into law. The governor can also veto the bill, return it to the Legislature for changes, or take a number of other less-common actions."
125125
}
126-
]
126+
],
127+
"additional_resources": "Additional Resources",
128+
"resources_intro": "We hope these pages will help you submit effective testimony. You may want to consult these other resources to build a more detailed understanding of the legislative process and how you can contribute.",
129+
"find_legislator": "The MA Legislature has an <0>online tool</0> you can use to identify your legislators based on your home address.",
130+
"legislative_doc": "The MA Legislature publishes a <0>document on the legislative process</0>.",
131+
"legal_services": "Mass Legal Services published a 2007 guide to The <0>Legislative Process in Massachusetts</0>."
127132
}
128133
}

0 commit comments

Comments
 (0)