BlueWallet/components/HeaderRightButton.tsx

44 lines
1 KiB
TypeScript
Raw Normal View History

2024-05-10 18:47:22 -04:00
import React from 'react';
2024-05-20 10:54:13 +01:00
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
2024-05-04 20:14:46 -04:00
import { useTheme } from './themes';
interface HeaderRightButtonProps {
2024-05-10 18:47:22 -04:00
disabled?: boolean;
2024-05-04 20:14:46 -04:00
onPress?: () => void;
title: string;
2024-05-05 01:03:39 -04:00
testID?: string;
2024-05-04 20:14:46 -04:00
}
2024-05-10 18:47:22 -04:00
const HeaderRightButton: React.FC<HeaderRightButtonProps> = ({ disabled = true, onPress, title, testID }) => {
2024-05-04 20:14:46 -04:00
const { colors } = useTheme();
2024-05-26 18:10:38 -04:00
const opacity = disabled ? 0.5 : 1;
2024-05-04 20:14:46 -04:00
return (
<TouchableOpacity
accessibilityRole="button"
disabled={disabled}
2024-05-26 18:10:38 -04:00
style={[styles.save, { backgroundColor: colors.lightButton }, { opacity }]}
2024-05-04 20:14:46 -04:00
onPress={onPress}
2024-05-05 01:03:39 -04:00
testID={testID}
2024-05-04 20:14:46 -04:00
>
<Text style={[styles.saveText, { color: colors.buttonTextColor }]}>{title}</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
save: {
alignItems: 'center',
justifyContent: 'center',
width: 80,
borderRadius: 8,
height: 34,
},
saveText: {
fontSize: 15,
fontWeight: '600',
},
});
2024-05-10 18:47:22 -04:00
export default HeaderRightButton;