Skip to content

Commit 55ba2a9

Browse files
authored
Merge pull request #450 from jkoren/adjust-profile-for-empty-data-fields
adjust public profile for empty data fields
2 parents 3cc9a49 + a9bc173 commit 55ba2a9

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

components/PublicProfile/PublicProfile.js

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,36 @@ const PublicProfile = ({ id }) => {
1010
const twit = user?.social?.twitter
1111
const linkedIn = user?.social?.linkedIn
1212

13+
const senatorLine = <h4>Senator: {user?.senator?.name}</h4>
14+
const representativeLine = (
15+
<h4>Representative: {user?.representative?.name}</h4>
16+
)
17+
const twitterLine = (
18+
<h4>
19+
Twitter:{" "}
20+
<links.External href={`https://www.twitter.com/${twit}`}>
21+
@{twit}
22+
</links.External>
23+
</h4>
24+
)
25+
26+
const linkedInLine = (
27+
<h4>
28+
LinkedIn:{" "}
29+
<links.External href={`https://www.linkedin.com/in/${linkedIn}`}>
30+
{linkedIn}
31+
</links.External>
32+
</h4>
33+
)
34+
1335
return (
1436
<>
1537
<h1>{user?.displayName ? user?.displayName : "Name placeholder"}</h1>
16-
<h4>Senator: {user?.senator?.name}</h4>
17-
<h4>Representative: {user?.representative?.name}</h4>
18-
<h4>
19-
Twitter:{" "}
20-
<links.External href={`https://www.twitter.com/${twit}`}>
21-
@{twit}
22-
</links.External>
23-
</h4>
24-
<h4>
25-
LinkedIn:{" "}
26-
<links.External href={`https://www.linkedin.com/in/${linkedIn}`}>
27-
{linkedIn}
28-
</links.External>
29-
</h4>
38+
{user?.senator ? senatorLine : <></>}
39+
{user?.representative ? representativeLine : <></>}
40+
{twit ? twitterLine : <></>}
41+
{linkedIn ? linkedInLine : <></>}
42+
3043
<p>{bio}</p>
3144
<UserTestimonies authorId={id} />
3245
</>

0 commit comments

Comments
 (0)