chore(SW-667): move formatMessage call to array

This commit is contained in:
Chuma McPhoy
2024-10-28 15:57:33 +01:00
parent d15e76de46
commit 365cb15f90

View File

@@ -12,10 +12,13 @@ export default async function ReadMore() {
const [intl, lang] = await Promise.all([getIntl(), getLang()]) const [intl, lang] = await Promise.all([getIntl(), getLang()])
const links = [ const links = [
{ href: faq[lang], translationId: "FAQ" }, {
href: faq[lang],
text: intl.formatMessage({ id: "FAQ" }),
},
{ {
href: membershipTermsAndConditions[lang], href: membershipTermsAndConditions[lang],
translationId: "Membership terms and conditions", text: intl.formatMessage({ id: "Membership terms and conditions" }),
}, },
] ]
@@ -23,11 +26,9 @@ export default async function ReadMore() {
<article className={styles.wrapper}> <article className={styles.wrapper}>
<Subtitle>{intl.formatMessage({ id: "Read more" })}</Subtitle> <Subtitle>{intl.formatMessage({ id: "Read more" })}</Subtitle>
<div className={styles.links}> <div className={styles.links}>
{links.map((link) => { {links.map((link) => (
const translatedText = intl.formatMessage({ id: link.translationId })
return (
<Link <Link
key={link.translationId} key={link.text}
size="small" size="small"
className={styles.link} className={styles.link}
color="burgundy" color="burgundy"
@@ -39,10 +40,9 @@ export default async function ReadMore() {
height="20" height="20"
width="20" width="20"
/> />
{translatedText} {link.text}
</Link> </Link>
) ))}
})}
</div> </div>
</article> </article>
) )