Skip to content

Commit

Permalink
Add support to add error text after description in notifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmymadon committed Jan 16, 2025
1 parent 28a6636 commit 44714c0
Showing 1 changed file with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,37 @@
* limitations under the License.
*/

/**
* WordPress dependencies
*/
import { Fragment } from '@wordpress/element';

/**
* Internal dependencies
*/
import { sanitizeHTML } from '../../../../util';
import ErrorText from '../../../../components/ErrorText';

export default function Description( {
className = 'googlesitekit-publisher-win__desc',
text,
learnMoreLink,
errorText,
} ) {
return (
<div className={ className }>
<p>
<span
dangerouslySetInnerHTML={ sanitizeHTML( text, {
ALLOWED_TAGS: [ 'strong', 'em', 'br', 'a' ],
ALLOWED_ATTR: [ 'href' ],
} ) }
/>{ ' ' }
{ learnMoreLink }
</p>
</div>
<Fragment>
<div className={ className }>
<p>
<span
dangerouslySetInnerHTML={ sanitizeHTML( text, {
ALLOWED_TAGS: [ 'strong', 'em', 'br', 'a' ],
ALLOWED_ATTR: [ 'href' ],
} ) }
/>{ ' ' }
{ learnMoreLink }
</p>
</div>
{ errorText && <ErrorText message={ errorText } /> }
</Fragment>
);
}

0 comments on commit 44714c0

Please sign in to comment.