diff --git a/app/index.tsx b/app/index.tsx index 780e71a..433ab4d 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -1,9 +1,9 @@ -import { StyleSheet, View, Text, NativeSyntheticEvent, NativeScrollEvent } from 'react-native'; +import { StyleSheet, View, Text, NativeSyntheticEvent, NativeScrollEvent, SafeAreaView } from 'react-native'; import { useThemeColor } from "../hooks/hooks"; -import { SafeAreaView } from 'react-native-safe-area-context'; -import { ExpenseItem, Plus } from '../components'; +import { ExpenseItem, Plus, Welcome } from '../components'; import { FlatList } from 'react-native-gesture-handler'; import { useRef, useState } from 'react'; +import React from 'react'; export default function Page() { @@ -22,6 +22,8 @@ export default function Page() { } }); + const profile = require("../assets/images/profile.jpg") + const handleScroll = (event: NativeSyntheticEvent)=>{ const currentOffset = event.nativeEvent.contentOffset.y >= 0 ? event.nativeEvent.contentOffset.y : 0 const isScrollingUp : boolean = currentOffset <= prevOffset.current; @@ -47,8 +49,10 @@ export default function Page() { return ( - + {plusShow && } + console.log("hello")}> + } @@ -56,6 +60,7 @@ export default function Page() { ItemSeparatorComponent={()=>} onScroll={handleScroll} scrollEventThrottle={20} + style={{paddingBottom: 5}} > diff --git a/assets/images/profile.jpg b/assets/images/profile.jpg new file mode 100644 index 0000000..f263453 Binary files /dev/null and b/assets/images/profile.jpg differ diff --git a/components/home/Welcome/Welcome.tsx b/components/home/Welcome/Welcome.tsx new file mode 100644 index 0000000..4e3762c --- /dev/null +++ b/components/home/Welcome/Welcome.tsx @@ -0,0 +1,66 @@ +import { View, Text, ViewProps, Image, GestureResponderEvent } from 'react-native' +import React from 'react' +import { MARGINS, SIZES, SHADOWS } from '../../../constants/theme' +import { TouchableOpacity } from 'react-native-gesture-handler' + +type WelcomeProps = ViewProps & {name: string, image : any, onPress: () => void | undefined} + +function formatDate(date: Date) : string { + const day = String(date.getDate()).padStart(2, '0') + const month = String(date.getMonth() + 1).padStart(2, '0') + const year = String(date.getFullYear()) + return `${day}.${month}.${year}` +} + +function getTimeOfDay(date: Date) : string { + const hour = date.getHours() + if(hour < 12){ + return "morning" + } else if(hour >= 12 && hour < 18){ + return "afternoon" + } else if(hour >= 18){ + return "evening" + } + return "day" +} + + + +export default function Welcome(props: WelcomeProps) { + const date = new Date() + const dateString = formatDate(date) + const timeOfDay = getTimeOfDay(date) + const onpress = props.onPress + + return ( + + + + + + {dateString} + + + Good {timeOfDay}, {props.name} + + + ) +} \ No newline at end of file diff --git a/components/index.jsx b/components/index.jsx index 793a530..56bab55 100644 --- a/components/index.jsx +++ b/components/index.jsx @@ -1,11 +1,13 @@ //home import ExpenseItem from "./home/expenseItem/expenseItem" +import Welcome from "./home/Welcome/Welcome" //common import Plus from "./common/plus/plus" export { ExpenseItem, + Welcome, Plus } diff --git a/constants/theme.ts b/constants/theme.ts index 413df5b..9bb46e0 100644 --- a/constants/theme.ts +++ b/constants/theme.ts @@ -2,9 +2,14 @@ const SIZES = { small: 12, normal: 17, large: 20, + xlarge: 25, xxLarge: 30 } +const MARGINS = { + normal: 10 +} + const SHADOWS = { light: { shadowColor: "#ADB7C3", @@ -15,4 +20,4 @@ const SHADOWS = { } } -export {SIZES, SHADOWS} \ No newline at end of file +export {SIZES, SHADOWS, MARGINS} \ No newline at end of file