BaaS_Driver_Android_App/components/home/Profile.tsx

46 lines
947 B
TypeScript

import React from "react";
import { Text, TouchableOpacity, StyleSheet } from "react-native";
type ProfileImageProps = {
username: string;
onClick?: () => void;
textSize?: number;
boxSize?: number;
};
const ProfileImage: React.FC<ProfileImageProps> = ({
username,
onClick,
textSize,
boxSize,
}) => {
const firstLetter = username?.substring(0, 1)?.toUpperCase() || "V";
return (
<TouchableOpacity
style={{ ...styles.container, width: boxSize, height: boxSize }}
onPress={onClick}
>
<Text style={{ ...styles.letter, fontSize: textSize }}>
{firstLetter}
</Text>
</TouchableOpacity>
);
};
export default ProfileImage;
const styles = StyleSheet.create({
container: {
borderRadius: 394.316,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#DAF5ED",
},
letter: {
color: "#008761",
fontFamily: "Inter",
fontWeight: "bold",
},
});