fix(client): return an empty string for empty sections
This commit is contained in:
@@ -9,17 +9,11 @@ const propTypes = {
|
||||
section: PropTypes.string
|
||||
};
|
||||
|
||||
function emptyInstruction(instructions) {
|
||||
return /^<section\s+id\s*=\s*("|')instructions\1\s*>\s*<\/section>$/.test(
|
||||
instructions
|
||||
);
|
||||
}
|
||||
|
||||
function ChallengeDescription({ description, instructions, section }) {
|
||||
return (
|
||||
<div className={`challenge-instructions ${section}`}>
|
||||
<div dangerouslySetInnerHTML={{ __html: description }} />
|
||||
{!emptyInstruction(instructions) && (
|
||||
{instructions && (
|
||||
<Fragment>
|
||||
<hr />
|
||||
<div dangerouslySetInnerHTML={{ __html: instructions }} />
|
||||
|
Reference in New Issue
Block a user