This commit is contained in:
Milan Paunovic
2024-10-21 10:03:30 +02:00
parent a7af6765a8
commit 6ff324f988

View File

@ -1,41 +1,43 @@
import { View, Text } from "react-native-ui-lib";
import {Image, Text, View} from "react-native-ui-lib";
import React from "react";
import { useAuthContext } from "@/contexts/AuthContext";
import { ImageBackground } from "react-native";
import {useAuthContext} from "@/contexts/AuthContext";
const HeaderTemplate = (props: {
message: string;
isWelcome: boolean;
children?: React.ReactNode;
link?: React.ReactNode;
message: string;
isWelcome: boolean;
children?: React.ReactNode;
link?: React.ReactNode;
}) => {
const { user, profileData } = useAuthContext();
const {user, profileData} = useAuthContext();
const headerHeight:number = 72;
return (
<View row centerV marginV-15>
<ImageBackground
source={require("../../assets/images/profile-picture.png")}
style={{
height: headerHeight,
aspectRatio: 1,
borderRadius: 22,
overflow: "hidden",
marginRight: 20,
}}
/>
<View gap-3>
{props.isWelcome && (
<Text text70L style={{fontSize: 19, fontFamily: "Manrope_400Regular"}}>Welcome, {profileData?.firstName}!</Text>
)}
<Text text70B style={{ fontSize: 18 , fontFamily: "Manrope_600SemiBold" }}>
{props.message}
</Text>
{props.children && <View>{props.children}</View>}
{props.link && <View marginT-8>{props.link}</View>}
</View>
</View>
);
const headerHeight: number = 72;
return (
<View row centerV marginV-15>
<Image
source={{uri: profileData?.pfp}}
style={{
height: headerHeight,
aspectRatio: 1,
borderRadius: 22,
overflow: "hidden",
marginRight: 20,
}}
/>
<View gap-3>
{props.isWelcome && (
<Text text70L style={{
fontSize: 19,
fontFamily: "Manrope_400Regular"
}}>Welcome, {profileData?.firstName}!</Text>
)}
<Text text70B style={{fontSize: 18, fontFamily: "Manrope_600SemiBold"}}>
{props.message}
</Text>
{props.children && <View>{props.children}</View>}
{props.link && <View marginT-8>{props.link}</View>}
</View>
</View>
);
};
export default HeaderTemplate;