1
1
import { ExternalRoutes } from "src/constants/routes" ;
2
+ import React from "react" ;
2
3
3
- import { Trans , useTranslation } from "next-i18next " ;
4
+ import { useTranslations , useMessages } from "next-intl " ;
4
5
import Link from "next/link" ;
5
6
import {
6
7
Button ,
7
8
Grid ,
8
- Icon ,
9
9
IconList ,
10
10
IconListContent ,
11
11
IconListIcon ,
12
12
IconListItem ,
13
13
IconListTitle ,
14
14
} from "@trussworks/react-uswds" ;
15
+ import { USWDSIcon } from "src/components/USWDSIcon" ;
15
16
16
17
import ContentLayout from "src/components/ContentLayout" ;
17
18
18
- type Boxes = {
19
- title : string ;
20
- content : string ;
21
- } ;
22
-
23
19
const ProcessMilestones = ( ) => {
24
- const { t } = useTranslation ( "common" , { keyPrefix : " Process" } ) ;
20
+ const t = useTranslations ( " Process") ;
25
21
26
- const iconList : Boxes [ ] = t ( "milestones.icon_list" , { returnObjects : true } ) ;
22
+ const messages = useMessages ( ) as unknown as IntlMessages ;
23
+ const keys = Object . keys ( messages . Process . milestones . icon_list ) ;
27
24
28
25
const getIcon = ( iconIndex : number ) => {
29
26
switch ( iconIndex ) {
30
27
case 0 :
31
- return < Icon . Search aria-hidden = { true } className = "text-middle " /> ;
28
+ return < USWDSIcon className = "usa-icon" name = "search " /> ;
32
29
case 1 :
33
- return < Icon . Assessment aria-hidden = { true } className = "text-middle " /> ;
30
+ return < USWDSIcon className = "usa-icon" name = "assessment " /> ;
34
31
case 2 :
35
- return < Icon . ContentCopy aria-hidden = { true } className = "text-middle " /> ;
32
+ return < USWDSIcon className = "usa-icon" name = "content_copy " /> ;
36
33
default :
37
34
return < > </ > ;
38
35
}
@@ -47,50 +44,55 @@ const ProcessMilestones = () => {
47
44
bottomBorder = "dark"
48
45
gridGap = { 6 }
49
46
>
50
- { ! Array . isArray ( iconList )
51
- ? ""
52
- : iconList . map ( ( box , index ) => {
53
- return (
54
- < Grid key = { box . title + "-key" } tabletLg = { { col : 4 } } >
55
- < IconList className = "usa-icon-list--size-lg" >
56
- < IconListItem className = "margin-top-4" >
57
- < IconListIcon > { getIcon ( index ) } </ IconListIcon >
58
- < IconListContent className = "tablet-lg:padding-right-3 desktop-lg:padding-right-105" >
59
- < IconListTitle className = "margin-bottom-2" type = "h3" >
60
- { box . title }
61
- </ IconListTitle >
62
- < Trans
63
- t = { t }
64
- i18nKey = { box . content }
65
- components = { {
66
- p : (
67
- < p className = "font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6" > </ p >
68
- ) ,
69
- chevron : (
70
- < Icon . NavigateNext
71
- className = "display-none tablet-lg:display-block text-base-lighter position-absolute right-0 top-0 margin-right-neg-5"
72
- size = { 9 }
73
- aria-label = "launch"
74
- />
75
- ) ,
76
- } }
47
+ { keys . map ( ( key , index ) => {
48
+ const title = t ( `milestones.icon_list.${ key } .title` ) ;
49
+ const content = t . rich ( `milestones.icon_list.${ key } .content` , {
50
+ p : ( chunks ) => (
51
+ < p className = "font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6" >
52
+ { chunks }
53
+ </ p >
54
+ ) ,
55
+ italics : ( chunks ) => < em > { chunks } </ em > ,
56
+ } ) ;
57
+
58
+ return (
59
+ < Grid key = { title + "-key" } tabletLg = { { col : 4 } } >
60
+ < IconList className = "usa-icon-list--size-lg" >
61
+ < IconListItem className = "margin-top-4" >
62
+ < IconListIcon > { getIcon ( index ) } </ IconListIcon >
63
+ < IconListContent className = "tablet-lg:padding-right-3 desktop-lg:padding-right-105" >
64
+ < IconListTitle className = "margin-bottom-2" type = "h3" >
65
+ { title }
66
+ </ IconListTitle >
67
+ < div className = "font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6" >
68
+ { content }
69
+ </ div >
70
+ {
71
+ // Don't show the chevron in the last row item.
72
+ index < keys . length - 1 ? (
73
+ < USWDSIcon
74
+ className = "usa-icon usa-icon--size-9 display-none tablet-lg:display-block text-base-lighter position-absolute right-0 top-0 margin-right-neg-5"
75
+ name = "navigate_next"
77
76
/>
78
- </ IconListContent >
79
- </ IconListItem >
80
- </ IconList >
81
- </ Grid >
82
- ) ;
83
- } ) }
77
+ ) : (
78
+ ""
79
+ )
80
+ }
81
+ </ IconListContent >
82
+ </ IconListItem >
83
+ </ IconList >
84
+ </ Grid >
85
+ ) ;
86
+ } ) }
84
87
</ ContentLayout >
85
88
< ContentLayout
86
89
title = {
87
90
< >
88
91
< small className = "display-block font-sans-lg margin-bottom-105" >
89
92
{ t ( "milestones.roadmap_1" ) }
90
- < Icon . NavigateNext
91
- className = "text-middle text-base-light"
92
- size = { 4 }
93
- aria-label = "launch"
93
+ < USWDSIcon
94
+ className = "usa-icon usa-icon--size-4 text-middle text-base-light"
95
+ name = "navigate_next"
94
96
/>
95
97
{ t ( "milestones.title_1" ) }
96
98
</ small >
@@ -120,10 +122,9 @@ const ProcessMilestones = () => {
120
122
< Link href = { ExternalRoutes . MILESTONE_GET_OPPORTUNITIES } passHref >
121
123
< Button className = "margin-bottom-4" type = "button" size = "big" >
122
124
< span className = "margin-right-5" > { t ( "milestones.cta_1" ) } </ span >
123
- < Icon . Launch
124
- className = "text-middle margin-left-neg-4"
125
- size = { 4 }
126
- aria-label = "launch"
125
+ < USWDSIcon
126
+ name = "launch"
127
+ className = "usa-icon usa-icon--size-4 text-middle margin-left-neg-4"
127
128
/>
128
129
</ Button >
129
130
</ Link >
@@ -134,10 +135,9 @@ const ProcessMilestones = () => {
134
135
< >
135
136
< small className = "display-block font-sans-lg margin-bottom-105" >
136
137
{ t ( "milestones.roadmap_2" ) }
137
- < Icon . NavigateNext
138
- className = "text-middle text-base-light"
139
- size = { 4 }
140
- aria-label = "launch"
138
+ < USWDSIcon
139
+ className = "usa-icon usa-icon--size-4 text-middle text-base-light"
140
+ name = "navigate_next"
141
141
/>
142
142
{ t ( "milestones.title_2" ) }
143
143
</ small >
@@ -156,37 +156,14 @@ const ProcessMilestones = () => {
156
156
< h3 className = "tablet-lg:font-sans-lg tablet-lg:margin-bottom-05" >
157
157
{ t ( "milestones.sub_title_3" ) }
158
158
</ h3 >
159
- < p className = "margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6" >
160
- < Trans
161
- t = { t }
162
- i18nKey = "milestones.sub_paragraph_3"
163
- components = { {
164
- LinkToGrants : (
165
- < a
166
- target = "_blank"
167
- rel = "noopener noreferrer"
168
- href = { ExternalRoutes . GRANTS_HOME }
169
- />
170
- ) ,
171
- } }
172
- />
173
- </ p >
174
- < p className = "margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6" >
175
- < Trans
176
- t = { t }
177
- i18nKey = "milestones.sub_paragraph_4"
178
- components = { {
179
- LinkToNewsletter : < Link href = "/newsletter" /> ,
180
- } }
181
- />
182
- </ p >
159
+ < p className = "margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6" > </ p >
160
+ < p className = "margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6" > </ p >
183
161
< Link href = { ExternalRoutes . MILESTONE_SEARCH_MVP } passHref >
184
162
< Button className = "margin-bottom-4" type = "button" size = "big" >
185
163
< span className = "margin-right-5" > { t ( "milestones.cta_2" ) } </ span >
186
- < Icon . Launch
187
- className = "text-middle margin-left-neg-4"
188
- size = { 4 }
189
- aria-label = "launch"
164
+ < USWDSIcon
165
+ name = "launch"
166
+ className = "usa-icon usa-icon--size-4 text-middle margin-left-neg-4"
190
167
/>
191
168
</ Button >
192
169
</ Link >
0 commit comments