-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DHIS2-17002): display custom text before and after a section
- Loading branch information
Showing
5 changed files
with
122 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as DOMPurify from 'dompurify' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import styles from './section.module.css' | ||
|
||
export const SectionDescription = ({ children }) => { | ||
if (!children) { | ||
return null | ||
} | ||
const html = DOMPurify.sanitize(children, { | ||
ALLOWED_TAGS: ['a', 'b', 'strong', 'underline'], | ||
}) | ||
|
||
return ( | ||
<div | ||
className={styles.sectionDescription} | ||
dangerouslySetInnerHTML={{ __html: html }} | ||
></div> | ||
) | ||
} | ||
|
||
SectionDescription.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters