Skip to content

[22658] Highlight specified cancel buttons #23464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 26, 2023
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