mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 06:52:41 +01:00
REF: LdkButton to TS (#6151)
This commit is contained in:
parent
89b2f2a307
commit
d8084d4b82
2 changed files with 78 additions and 37 deletions
|
@ -1,37 +0,0 @@
|
|||
/* eslint react/prop-types: "off", react-native/no-inline-styles: "off" */
|
||||
|
||||
import { Image, TouchableOpacity, View } from 'react-native';
|
||||
import { Text } from 'react-native-elements';
|
||||
import React from 'react';
|
||||
import { useTheme } from './themes';
|
||||
|
||||
export const LdkButton = props => {
|
||||
const { colors } = useTheme();
|
||||
return (
|
||||
<TouchableOpacity accessibilityRole="button" onPress={props.onPress}>
|
||||
<View
|
||||
style={{
|
||||
borderColor: (props.active && colors.lnborderColor) || colors.buttonDisabledBackgroundColor,
|
||||
borderWidth: 1.5,
|
||||
borderRadius: 8,
|
||||
backgroundColor: colors.buttonDisabledBackgroundColor,
|
||||
minWidth: props.style.width,
|
||||
minHeight: props.style.height,
|
||||
height: props.style.height,
|
||||
flex: 1,
|
||||
marginBottom: 8,
|
||||
}}
|
||||
>
|
||||
<View style={{ marginHorizontal: 16, marginVertical: 10, flexDirection: 'row', alignItems: 'center' }}>
|
||||
<View>
|
||||
<Image style={{ width: 34, height: 34, marginRight: 8 }} source={require('../img/addWallet/lightning.png')} />
|
||||
</View>
|
||||
<View>
|
||||
<Text style={{ color: colors.lnborderColor, fontWeight: 'bold', fontSize: 18 }}>{props.text || '?'}</Text>
|
||||
<Text style={{ color: colors.alternativeTextColor, fontSize: 13, fontWeight: '500' }}>{props.subtext || '?'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
};
|
78
components/LdkButton.tsx
Normal file
78
components/LdkButton.tsx
Normal file
|
@ -0,0 +1,78 @@
|
|||
import { DimensionValue, Image, StyleSheet, TouchableOpacity, View } from 'react-native';
|
||||
import { Text } from 'react-native-elements';
|
||||
import React from 'react';
|
||||
import { useTheme } from './themes';
|
||||
|
||||
interface LdkButtonProps {
|
||||
text: string;
|
||||
subtext: string;
|
||||
active: boolean;
|
||||
style: {
|
||||
width: DimensionValue;
|
||||
height: DimensionValue;
|
||||
};
|
||||
onPress: () => void;
|
||||
}
|
||||
|
||||
export const LdkButton: React.FC<LdkButtonProps> = ({ text, subtext, active, style, onPress }) => {
|
||||
const { colors } = useTheme();
|
||||
const stylesHook = StyleSheet.create({
|
||||
container: {
|
||||
borderColor: (active && colors.lnborderColor) || colors.buttonDisabledBackgroundColor,
|
||||
backgroundColor: colors.buttonDisabledBackgroundColor,
|
||||
minWidth: style.width,
|
||||
minHeight: style.height,
|
||||
height: style.height,
|
||||
},
|
||||
text: {
|
||||
color: colors.lnborderColor,
|
||||
},
|
||||
subtext: {
|
||||
color: colors.alternativeTextColor,
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<TouchableOpacity accessibilityRole="button" onPress={onPress}>
|
||||
<View style={[stylesHook.container, styles.container]}>
|
||||
<View style={styles.contentContainer}>
|
||||
<View>
|
||||
<Image style={styles.image} source={require('../img/addWallet/lightning.png')} />
|
||||
</View>
|
||||
<View>
|
||||
<Text style={[stylesHook.text, styles.text]}>{text}</Text>
|
||||
<Text style={[stylesHook.subtext, styles.subtext]}>{subtext}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
borderWidth: 1.5,
|
||||
borderRadius: 8,
|
||||
flex: 1,
|
||||
marginBottom: 8,
|
||||
},
|
||||
contentContainer: {
|
||||
marginHorizontal: 16,
|
||||
marginVertical: 10,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
},
|
||||
image: {
|
||||
width: 34,
|
||||
height: 34,
|
||||
marginRight: 8,
|
||||
},
|
||||
text: {
|
||||
fontWeight: 'bold',
|
||||
fontSize: 18,
|
||||
},
|
||||
subtext: {
|
||||
fontSize: 13,
|
||||
fontWeight: '500',
|
||||
},
|
||||
});
|
Loading…
Add table
Reference in a new issue