Skip to content

Commit

Permalink
Merge pull request #3105 from Expensify/joe-iou-badge-colors
Browse files Browse the repository at this point in the history
Change IOUBadge color depending on which user owes money
  • Loading branch information
Nicholas Murray authored May 25, 2021
2 parents 3838efb + fb23474 commit 5dcfe0d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/IOUBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,31 @@ const propTypes = {
iouReport: PropTypes.shape({
/** The total amount in cents */
total: PropTypes.number,

/** The owner of the IOUReport */
ownerEmail: PropTypes.string,
}),

/** Session of currently logged in user */
session: PropTypes.shape({
email: PropTypes.string.isRequired,
}).isRequired,
};

const defaultProps = {
iouReport: {
total: 0,
ownerEmail: null,
},
};

const IOUBadge = props => (
<View
style={[styles.badge, styles.badgeSuccess, styles.ml2]}
style={[
styles.badge,
styles.ml2,
props.session.email === props.iouReport.ownerEmail ? styles.badgeSuccess : styles.badgeDanger,
]}
>
<Text
style={styles.badgeText}
Expand All @@ -40,4 +53,7 @@ export default withOnyx({
iouReport: {
key: ({iouReportID}) => `${ONYXKEYS.COLLECTION.REPORT_IOUS}${iouReportID}`,
},
session: {
key: ONYXKEYS.SESSION,
},
})(IOUBadge);

0 comments on commit 5dcfe0d

Please sign in to comment.