Feature: Remove donate button for iOS

This commit is contained in:
BloodyMarie
2022-05-22 15:02:20 +02:00
committed by Marie Kochsiek
parent 68d8a55034
commit 8721bc484c
2 changed files with 25 additions and 13 deletions
+18 -11
View File
@@ -11,19 +11,21 @@ const Button = ({
children, children,
iconName, iconName,
isCTA, isCTA,
isVisible,
isSmall, isSmall,
onPress, onPress,
testID, testID,
...props ...props
}) => { }) => {
const buttonStyle = isCTA ? styles.cta : styles.regular const buttonStyle = isCTA ? styles.cta : styles.regular
const buttonDisplay = isVisible ? styles.isVisible : null
const textCTA = isCTA ? styles.buttonTextBold : styles.buttonTextRegular const textCTA = isCTA ? styles.buttonTextBold : styles.buttonTextRegular
const textStyle = [textCTA, isSmall ? textSmall : text] const textStyle = [textCTA, isSmall ? textSmall : text]
return ( return (
<TouchableOpacity <TouchableOpacity
onPress={onPress} onPress={onPress}
style={buttonStyle} style={[buttonStyle, buttonDisplay]}
testID={testID} testID={testID}
{...props} {...props}
> >
@@ -37,24 +39,25 @@ Button.propTypes = {
children: PropTypes.node, children: PropTypes.node,
iconName: PropTypes.string, iconName: PropTypes.string,
isCTA: PropTypes.bool, isCTA: PropTypes.bool,
isVisible: PropTypes.bool,
isSmall: PropTypes.bool, isSmall: PropTypes.bool,
onPress: PropTypes.func, onPress: PropTypes.func,
testID: PropTypes.string testID: PropTypes.string,
} }
Button.defaultProps = { Button.defaultProps = {
isSmall: true isSmall: true,
} }
const text = { const text = {
padding: Spacing.base, padding: Spacing.base,
textTransform: 'uppercase' textTransform: 'uppercase',
} }
const textSmall = { const textSmall = {
fontSize: Sizes.small, fontSize: Sizes.small,
padding: Spacing.small, padding: Spacing.small,
textTransform: 'uppercase' textTransform: 'uppercase',
} }
const button = { const button = {
@@ -64,26 +67,30 @@ const button = {
justifyContent: 'center', justifyContent: 'center',
marginTop: Spacing.base, marginTop: Spacing.base,
paddingHorizontal: Spacing.tiny, paddingHorizontal: Spacing.tiny,
minWidth: '15%' minWidth: '15%',
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
regular: { regular: {
...button ...button,
}, },
cta: { cta: {
backgroundColor: Colors.orange, backgroundColor: Colors.orange,
borderRadius: 25, borderRadius: 25,
...button ...button,
},
isVisible: {
display: 'none',
...button,
}, },
buttonTextBold: { buttonTextBold: {
color: 'white', color: 'white',
fontFamily: Fonts.bold fontFamily: Fonts.bold,
}, },
buttonTextRegular: { buttonTextRegular: {
color: Colors.greyDark, color: Colors.greyDark,
fontFamily: Fonts.main fontFamily: Fonts.main,
} },
}) })
export default Button export default Button
+7 -2
View File
@@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import { Linking } from 'react-native' import { Platform, Linking } from 'react-native'
import AppPage from '../common/app-page' import AppPage from '../common/app-page'
import AppText from '../common/app-text' import AppText from '../common/app-text'
@@ -36,7 +36,12 @@ const AboutSection = () => {
</Segment> </Segment>
<Segment title={labels.donate.title}> <Segment title={labels.donate.title}>
<AppText>{labels.donate.note}</AppText> <AppText>{labels.donate.note}</AppText>
<Button isCTA isSmall onPress={() => Linking.openURL(links.donate.url)}> <Button
isVisible={Platform.OS === 'ios' ? true : false}
isCTA
isSmall
onPress={() => Linking.openURL(links.donate.url)}
>
{links.donate.text} {links.donate.text}
</Button> </Button>
</Segment> </Segment>