Skip to content

Commit

Permalink
Don't render empty bios
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyford committed Nov 27, 2024
1 parent 583e800 commit 0b0ccb4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dotcom-rendering/src/components/MiniProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,16 @@ export const MiniProfile = ({
);
};

const containsText = (html: string) => {
const htmlWithoutTags = sanitise(html, {
allowedTags: [],
allowedAttributes: {},
});
return htmlWithoutTags.length > 0;
};

const Bio = ({ html }: { html?: string }) => {
if (!html) return null;
if (!html || !containsText(html)) return null;
const sanitizedHtml = sanitise(html, {});
return (
<>
Expand Down

0 comments on commit 0b0ccb4

Please sign in to comment.