1 |
|
import {HamburgerIcon, Pressable, Menu, Text, Icon, ChevronRightIcon, HStack} from "native-base"
|
|
1 |
import {HamburgerIcon, Pressable, Menu, Text, Icon, ChevronRightIcon, HStack, VStack} from "native-base"
|
2 |
2 |
import {useRoute} from "@react-navigation/native"
|
|
3 |
import {Dimensions} from "react-native"
|
|
4 |
import React from "react"
|
|
5 |
import {AntDesign} from "@expo/vector-icons"
|
3 |
6 |
|
4 |
7 |
type MenuComponentProps = {
|
5 |
8 |
navigation: any
|
6 |
9 |
}
|
7 |
10 |
|
|
11 |
const screenWidth = Dimensions.get('window').width; // Get full screen width
|
|
12 |
|
|
13 |
|
8 |
14 |
const MenuComponent = (props: MenuComponentProps) => {
|
9 |
15 |
const route = useRoute().name
|
10 |
16 |
|
11 |
17 |
return (
|
12 |
18 |
<>
|
13 |
|
<Menu w="190" color={"primary.500"} trigger={ triggerProps => {
|
|
19 |
<Menu w={screenWidth} mt={2} shadow={"0"} color={"primary.500"} backgroundColor={"white"} trigger={ triggerProps => {
|
14 |
20 |
return <Pressable accessibilityLabel="More options menu" { ...triggerProps }>
|
15 |
|
<HamburgerIcon color={"primary.500"}/>
|
|
21 |
<HamburgerIcon color={"primary.500"} size={"lg"}/>
|
16 |
22 |
</Pressable>
|
17 |
23 |
|
18 |
24 |
} }>
|
19 |
|
<Menu.Item
|
20 |
|
onPress={ () => props.navigation.navigate("Home") }
|
21 |
|
_text={ { color: "primary.500" } }
|
22 |
|
_pressed={ { bg: "secondary.500" } }
|
23 |
|
bg={ route === "Home" ? "secondary.500" : "white" }
|
24 |
|
>
|
25 |
|
<HStack justifyContent={ "space-between" } flex={ 1 }>
|
26 |
|
<Text>Home</Text>
|
27 |
|
<ChevronRightIcon/>
|
28 |
|
</HStack>
|
29 |
|
</Menu.Item>
|
30 |
|
<Menu.Item
|
31 |
|
onPress={ () => props.navigation.navigate("Notes") }
|
32 |
|
_text={ { color: "primary.500" } }
|
33 |
|
_pressed={ { bg: "secondary.500" } }
|
34 |
|
bg={ route === "Notes" ? "secondary.500" : "white" }
|
35 |
|
>
|
36 |
|
<HStack justifyContent={ "space-between" } flex={ 1 }>
|
37 |
|
<Text>Notes</Text>
|
38 |
|
<ChevronRightIcon/>
|
39 |
|
</HStack>
|
40 |
|
</Menu.Item>
|
41 |
|
<Menu.Item
|
42 |
|
onPress={ () => props.navigation.navigate("Search", { inventoryId: null }) }
|
43 |
|
_text={ { color: "primary.500" } }
|
44 |
|
_pressed={ { bg: "secondary.500" } }
|
45 |
|
bg={ route === "Search" ? "secondary.500" : "white" }
|
46 |
|
>
|
47 |
|
<HStack justifyContent={ "space-between" } flex={ 1 }>
|
48 |
|
<Text>Search</Text>
|
49 |
|
<ChevronRightIcon/>
|
50 |
|
</HStack>
|
51 |
|
</Menu.Item>
|
52 |
|
<Menu.Item
|
53 |
|
onPress={ () => props.navigation.navigate("Plan", { placeId: undefined, roomId: undefined }) }
|
54 |
|
_text={ { color: "primary.500" } }
|
55 |
|
_pressed={ { bg: "secondary.500" } }
|
56 |
|
bg={ route === "Plan" ? "secondary.500" : "white" }
|
57 |
|
>
|
58 |
|
<HStack justifyContent={ "space-between" } flex={ 1 }>
|
59 |
|
<Text>Plan</Text>
|
60 |
|
<ChevronRightIcon/>
|
61 |
|
</HStack>
|
62 |
|
</Menu.Item>
|
63 |
|
<Menu.Item
|
64 |
|
onPress={ () => props.navigation.navigate("Logout") }
|
65 |
|
_text={ { color: "primary.500" } }
|
66 |
|
_pressed={ { bg: "secondary.500" } }
|
67 |
|
justifyContent={ "space-between" }
|
68 |
|
flex={ 1 }
|
69 |
|
>
|
70 |
|
<HStack justifyContent={ "space-between" } flex={ 1 }>
|
71 |
|
<Text>Logout</Text>
|
72 |
|
<ChevronRightIcon/>
|
73 |
|
</HStack>
|
74 |
|
</Menu.Item>
|
|
25 |
<VStack width={"full"} >
|
|
26 |
<Menu.Item
|
|
27 |
onPress={ () => props.navigation.navigate("Home") }
|
|
28 |
_text={ { color: "primary.500" } }
|
|
29 |
_pressed={ { bg: "secondary.500" } }
|
|
30 |
bg={ route === "Home" ? "secondary.500" : "white" }
|
|
31 |
rounded={"3xl"}
|
|
32 |
mx={5}
|
|
33 |
>
|
|
34 |
<HStack justifyContent="space-between" alignItems="center" w="100%">
|
|
35 |
<HStack alignItems="center" space={2}>
|
|
36 |
<Icon as={<AntDesign name="home" />} color="primary.500" size={"lg"} />
|
|
37 |
<Text fontSize={"lg"} color={"primary.500"} fontWeight={"bold"}>Home</Text>
|
|
38 |
</HStack>
|
|
39 |
<ChevronRightIcon color="primary.500" />
|
|
40 |
</HStack>
|
|
41 |
</Menu.Item>
|
|
42 |
<Menu.Item
|
|
43 |
onPress={ () => props.navigation.navigate("Notes") }
|
|
44 |
_text={ { color: "primary.500" } }
|
|
45 |
_pressed={ { bg: "secondary.500" } }
|
|
46 |
bg={ route === "Notes" ? "secondary.500" : "white" }
|
|
47 |
rounded={"3xl"}
|
|
48 |
mx={5}
|
|
49 |
>
|
|
50 |
<HStack justifyContent="space-between" alignItems="center" w="100%">
|
|
51 |
<HStack alignItems="center" space={2}>
|
|
52 |
<Icon as={<AntDesign name="profile" />} color="primary.500" size={"lg"}/>
|
|
53 |
<Text fontSize={"lg"} color={"primary.500"} fontWeight={"bold"}>Notes</Text>
|
|
54 |
</HStack>
|
|
55 |
<ChevronRightIcon color="primary.500" />
|
|
56 |
</HStack>
|
|
57 |
</Menu.Item>
|
|
58 |
<Menu.Item
|
|
59 |
onPress={ () => props.navigation.navigate("Search", { inventoryId: null }) }
|
|
60 |
_text={ { color: "primary.500" } }
|
|
61 |
_pressed={ { bg: "secondary.500" } }
|
|
62 |
bg={ route === "Search" ? "secondary.500" : "white" }
|
|
63 |
rounded={"3xl"}
|
|
64 |
mx={5}
|
|
65 |
>
|
|
66 |
<HStack justifyContent="space-between" alignItems="center" w="100%">
|
|
67 |
<HStack alignItems="center" space={2}>
|
|
68 |
<Icon as={<AntDesign name="search1" />} color="primary.500" size={"lg"}/>
|
|
69 |
<Text fontSize={"lg"} color={"primary.500"} fontWeight={"bold"}>Search</Text>
|
|
70 |
</HStack>
|
|
71 |
<ChevronRightIcon color="primary.500" />
|
|
72 |
</HStack>
|
|
73 |
</Menu.Item>
|
|
74 |
<Menu.Item
|
|
75 |
onPress={ () => props.navigation.navigate("Plan", { placeId: undefined, roomId: undefined }) }
|
|
76 |
_text={ { color: "primary.500" } }
|
|
77 |
_pressed={ { bg: "secondary.500" } }
|
|
78 |
bg={ route === "Plan" ? "secondary.500" : "white" }
|
|
79 |
rounded={"3xl"}
|
|
80 |
mx={5}
|
|
81 |
>
|
|
82 |
<HStack rounded={"lg"} justifyContent="space-between" alignItems="center" w="100%">
|
|
83 |
<HStack alignItems="center" space={2}>
|
|
84 |
<Icon as={<AntDesign name="appstore-o" />} color="primary.500" size={"lg"} />
|
|
85 |
<Text fontSize={"lg"} color={"primary.500"} fontWeight={"bold"}>Plan</Text>
|
|
86 |
</HStack>
|
|
87 |
<ChevronRightIcon color="primary.500" />
|
|
88 |
</HStack>
|
|
89 |
</Menu.Item>
|
|
90 |
<Menu.Item
|
|
91 |
onPress={ () => props.navigation.navigate("Logout") }
|
|
92 |
_text={ { color: "primary.500" } }
|
|
93 |
_pressed={ { bg: "secondary.500" } }
|
|
94 |
rounded={"3xl"}
|
|
95 |
mx={5}
|
|
96 |
>
|
|
97 |
<HStack justifyContent="space-between" alignItems="center" w="100%">
|
|
98 |
<HStack alignItems="center" space={2}>
|
|
99 |
<Icon as={<AntDesign name="logout" />} color="primary.500" size={"lg"} />
|
|
100 |
<Text fontSize={"lg"} color={"primary.500"} fontWeight={"bold"}>Logout</Text>
|
|
101 |
</HStack>
|
|
102 |
<ChevronRightIcon color="primary.500" />
|
|
103 |
</HStack>
|
|
104 |
</Menu.Item>
|
|
105 |
</VStack>
|
75 |
106 |
|
76 |
107 |
</Menu>
|
77 |
108 |
</>
|
Merge dev into PlanView