Skip to content

Commit

Permalink
Merge pull request #23464 from DanutGavrus/fix/22658-highlight-cancel…
Browse files Browse the repository at this point in the history
…-button

[22658] Highlight specified cancel buttons
  • Loading branch information
Gonals authored Jul 26, 2023
2 parents 3d22f59 + 3c240a3 commit d68806f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ const propTypes = {
// eslint-disable-next-line react/forbid-prop-types
textStyles: PropTypes.arrayOf(PropTypes.object),

/** Whether we should use the default hover style */
shouldUseDefaultHover: PropTypes.bool,

/** Whether we should use the success theme color */
success: PropTypes.bool,

Expand Down Expand Up @@ -142,6 +145,7 @@ const defaultProps = {
style: [],
innerStyles: [],
textStyles: [],
shouldUseDefaultHover: false,
success: false,
danger: false,
children: null,
Expand Down Expand Up @@ -295,6 +299,7 @@ class Button extends Component {
...this.props.innerStyles,
]}
hoverStyle={[
this.props.shouldUseDefaultHover && !this.props.isDisabled ? styles.buttonDefaultHovered : undefined,
this.props.success && !this.props.isDisabled ? styles.buttonSuccessHovered : undefined,
this.props.danger && !this.props.isDisabled ? styles.buttonDangerHovered : undefined,
]}
Expand Down
1 change: 1 addition & 0 deletions src/components/ConfirmContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function ConfirmContent(props) {
style={[styles.mt3, styles.noSelect]}
onPress={props.onCancel}
text={props.cancelText || props.translate('common.no')}
shouldUseDefaultHover
/>
)}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ class BasePaymentsPage extends React.Component {
onPress={this.navigateToAddPaypalRoute}
style={[styles.mb4]}
text={this.props.translate('common.edit')}
shouldUseDefaultHover
/>
)}
<Button
Expand Down
5 changes: 5 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,11 @@ const styles = {
textAlign: 'center',
},

buttonDefaultHovered: {
backgroundColor: themeColors.buttonHoveredBG,
borderWidth: 0,
},

buttonSuccess: {
backgroundColor: themeColors.success,
borderWidth: 0,
Expand Down

0 comments on commit d68806f

Please sign in to comment.