Skip to content

Commit 60cc47f

Browse files
committed
Improve rendering of religion in about me
1 parent 7e4f606 commit 60cc47f

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

web/components/profile-about.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,32 @@ export function AboutRow(props: {
3131
icon: ReactNode
3232
text?: string | null | string[]
3333
preText?: string
34+
suffix?: string | null
3435
}) {
35-
const {icon, text, preText} = props
36-
if (!text || text.length < 1) {
36+
const {icon, text, preText, suffix} = props
37+
if (!text?.length && !preText && !suffix) {
3738
return <></>
3839
}
40+
let formattedText = ''
41+
if (preText) {
42+
formattedText += preText
43+
}
44+
if (text?.length) {
45+
formattedText += stringOrStringArrayToText({
46+
text: text,
47+
preText: preText,
48+
asSentence: false,
49+
capitalizeFirstLetterOption: true,
50+
})
51+
}
52+
if (suffix) {
53+
formattedText += formattedText ? ` (${suffix})` : suffix
54+
}
3955
return (
4056
<Row className="items-center gap-2">
4157
<div className="text-ink-600 w-5">{icon}</div>
4258
<div>
43-
{stringOrStringArrayToText({
44-
text: text,
45-
preText: preText,
46-
asSentence: false,
47-
capitalizeFirstLetterOption: true,
48-
})}
59+
{formattedText}
4960
</div>
5061
</Row>
5162
)
@@ -72,10 +83,7 @@ export default function ProfileAbout(props: {
7283
<AboutRow
7384
icon={<PiHandsPrayingBold className="h-5 w-5"/>}
7485
text={profile.religion?.map(belief => REVERTED_RELIGION_CHOICES[belief])}
75-
/>
76-
<AboutRow
77-
icon={<PiHandsPrayingBold className="h-5 w-5"/>}
78-
text={profile.religious_beliefs}
86+
suffix={profile.religious_beliefs}
7987
/>
8088
<AboutRow
8189
icon={<HiOutlineGlobe className="h-5 w-5"/>}

0 commit comments

Comments
 (0)