Skip to content

Commit

Permalink
Add showDiff to PropTypes. Switch if/else class assignment to ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
nai888 committed Dec 31, 2018
1 parent f11d493 commit 75fcd02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/routes/Morph/MorphResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ const MorphResults = props => {
}

const classes = result => {
if (result.changed && props.showDiff) {
return classNames(props.styles.outText, props.styles.changed)
} else {
return props.styles.outText
}
return result.changed && props.showDiff
? classNames(props.styles.outText, props.styles.changed)
: props.styles.outText
}

return resultsArr.length > 0 ? (
Expand Down Expand Up @@ -91,7 +89,8 @@ MorphResults.propTypes = {
output: PropTypes.string.isRequired,
changed: PropTypes.bool.isRequired
})
)
),
showDiff: PropTypes.bool.isRequired
}

export default injectSheet(sharedResultsStyles)(MorphResults)
1 change: 1 addition & 0 deletions src/routes/Morph/MorphResults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('MorphResults', () => {
styles={classes}
outputFormat={defData.outputFormat}
results={results}
showDiff={defData.showDiff}
/>,
div
)
Expand Down

0 comments on commit 75fcd02

Please sign in to comment.