Skip to content

Commit e4acb25

Browse files
committed
Better render headings and lists in profile grid
1 parent c741e10 commit e4acb25

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

web/components/profile-grid.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ function ProfilePreview(props: {
8484
const {user} = profile
8585
// const currentUser = useUser()
8686

87+
let bio = profile.bio as JSONContent;
88+
89+
if (bio && bio.content) {
90+
// Convert heading and list to paragraph
91+
bio.content = bio.content?.map(c => {
92+
if (c.type === 'heading' || c.type === 'list') {
93+
return {
94+
type: 'paragraph',
95+
content: c.content
96+
}
97+
}
98+
return c
99+
})
100+
}
101+
87102
return (
88103
<Link
89104
onClick={() => track('click love profile preview')}
@@ -135,7 +150,7 @@ function ProfilePreview(props: {
135150
</h3>
136151
<div className="text-sm text-gray-500 dark:text-gray-400">
137152
{/*TODO: fix nested <a> links warning (one from Link above, one from link in bio below)*/}
138-
<Content className="w-full line-clamp-4" content={profile.bio as JSONContent}/>
153+
<Content className="w-full line-clamp-4" content={bio}/>
139154
</div>
140155
{/*{age}*/}
141156
</div>

0 commit comments

Comments
 (0)