Skip to content

Commit c469ea0

Browse files
Debug broken anchor (#9494)
* Debug broken anchor * Fix anchors and broken note * Enhance Popover component to render only on the client side * Cleanup from debug * Apply Prettier formatting --------- Co-authored-by: gfbollingerHakuna <[email protected]>
1 parent 63bd955 commit c469ea0

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/components/popover.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
import React from "react"
1+
import React, { useState, useEffect } from 'react';
22

3-
import { Popover as PDSPopover } from "@pantheon-systems/pds-toolkit-react"
3+
import { Popover as PDSPopover } from '@pantheon-systems/pds-toolkit-react';
44

55
const Popover = ({ icon, title, content }) => {
6-
const processedContent = <div dangerouslySetInnerHTML={{ __html: content }} />
6+
const processedContent = (
7+
<div dangerouslySetInnerHTML={{ __html: content }} />
8+
);
9+
const [isClient, setIsClient] = useState(false);
710

8-
return <PDSPopover content={processedContent} title={title} />
9-
}
11+
useEffect(() => {
12+
setIsClient(true);
13+
}, []);
1014

11-
export default Popover
15+
if (!isClient) {
16+
return null;
17+
}
18+
19+
return <PDSPopover content={processedContent} title={title} />;
20+
};
21+
22+
export default Popover;

0 commit comments

Comments
 (0)