Skip to content

Commit 258d687

Browse files
fix(ui): render certification on profile page in ul (freeCodeCamp#55576)
Co-authored-by: Huyen Nguyen <[email protected]>
1 parent bd85192 commit 258d687

File tree

2 files changed

+40
-23
lines changed

2 files changed

+40
-23
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.profile-certifications {
2+
ul {
3+
list-style-type: none;
4+
margin: 0;
5+
padding: 0;
6+
}
7+
}

client/src/components/profile/components/certifications.tsx

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { createSelector } from 'reselect';
66
import { certificatesByNameSelector } from '../../../redux/selectors';
77
import type { CurrentCert } from '../../../redux/prop-types';
88
import { FullWidthRow, Spacer, ButtonLink } from '../../helpers';
9+
import './certifications.css';
910

1011
const mapStateToProps = (
1112
state: Record<string, unknown>,
@@ -45,7 +46,7 @@ interface CertButtonProps {
4546
function CertButton({ username, cert }: CertButtonProps): JSX.Element {
4647
const { t } = useTranslation();
4748
return (
48-
<>
49+
<li>
4950
<ButtonLink
5051
block
5152
size='large'
@@ -56,7 +57,7 @@ function CertButton({ username, cert }: CertButtonProps): JSX.Element {
5657
})}
5758
</ButtonLink>
5859
<Spacer size='small' />
59-
</>
60+
</li>
6061
);
6162
}
6263

@@ -69,36 +70,45 @@ function Certificates({
6970
}: CertificationProps): JSX.Element {
7071
const { t } = useTranslation();
7172
return (
72-
<FullWidthRow className='certifications'>
73-
<h2>{t('profile.fcc-certs')}</h2>
73+
<FullWidthRow className='profile-certifications'>
74+
<h2 id='fcc-certifications'>{t('profile.fcc-certs')}</h2>
7475
<br />
7576
{hasModernCert && currentCerts ? (
76-
currentCerts
77-
.filter(({ show }) => show)
78-
.map(cert => (
79-
<CertButton key={cert.certSlug} cert={cert} username={username} />
80-
))
77+
<ul aria-labelledby='fcc-certifications'>
78+
{currentCerts
79+
.filter(({ show }) => show)
80+
.map(cert => (
81+
<CertButton key={cert.certSlug} cert={cert} username={username} />
82+
))}
83+
</ul>
8184
) : (
8285
<p className='text-center'>{t('profile.no-certs')}</p>
8386
)}
84-
{hasLegacyCert ? (
87+
{hasLegacyCert && (
8588
<div>
8689
<Spacer size='medium' />
87-
<h3>{t('settings.headings.legacy-certs')}</h3>
88-
<Spacer size='medium' />
89-
{legacyCerts &&
90-
legacyCerts
91-
.filter(({ show }) => show)
92-
.map(cert => (
93-
<CertButton
94-
key={cert.certSlug}
95-
cert={cert}
96-
username={username}
97-
/>
98-
))}
90+
<h3 id='legacy-certifications'>
91+
{t('settings.headings.legacy-certs')}
92+
</h3>
9993
<Spacer size='medium' />
94+
{legacyCerts && (
95+
<>
96+
<ul aria-labelledby='legacy-certifications'>
97+
{legacyCerts
98+
.filter(({ show }) => show)
99+
.map(cert => (
100+
<CertButton
101+
key={cert.certSlug}
102+
cert={cert}
103+
username={username}
104+
/>
105+
))}
106+
</ul>
107+
<Spacer size='medium' />
108+
</>
109+
)}
100110
</div>
101-
) : null}
111+
)}
102112
<hr />
103113
</FullWidthRow>
104114
);

0 commit comments

Comments
 (0)