2024-05-04 00:33:23 +02:00
|
|
|
import React from 'react';
|
2024-05-20 11:54:13 +02:00
|
|
|
import { StyleSheet, Text, View } from 'react-native';
|
|
|
|
|
2024-05-04 00:33:23 +02:00
|
|
|
import loc from '../loc';
|
2024-05-20 11:54:13 +02:00
|
|
|
import PlusIcon from './icons/PlusIcon';
|
|
|
|
import { useTheme } from './themes';
|
2024-05-04 00:33:23 +02:00
|
|
|
|
|
|
|
interface HeaderProps {
|
|
|
|
leftText: string;
|
|
|
|
isDrawerList?: boolean;
|
|
|
|
onNewWalletPress?: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Header: React.FC<HeaderProps> = ({ leftText, isDrawerList, onNewWalletPress }) => {
|
|
|
|
const { colors } = useTheme();
|
|
|
|
const styleWithProps = StyleSheet.create({
|
|
|
|
root: {
|
|
|
|
backgroundColor: isDrawerList ? colors.elevated : colors.background,
|
|
|
|
borderTopColor: isDrawerList ? colors.elevated : colors.background,
|
|
|
|
borderBottomColor: isDrawerList ? colors.elevated : colors.background,
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
color: colors.foregroundColor,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={[styles.root, styleWithProps.root]}>
|
|
|
|
<Text style={[styles.text, styleWithProps.text]}>{leftText}</Text>
|
|
|
|
{onNewWalletPress && <PlusIcon accessibilityRole="button" accessibilityLabel={loc.wallets.add_title} onPress={onNewWalletPress} />}
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
root: {
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
alignItems: 'center',
|
|
|
|
paddingHorizontal: 16,
|
|
|
|
marginBottom: 8,
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
textAlign: 'left',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 34,
|
|
|
|
},
|
|
|
|
});
|