1 |
1abbf06f
|
František Kaiser
|
import {HamburgerIcon, Pressable, Menu, Text, Icon, ChevronRightIcon, HStack, VStack} from "native-base"
|
2 |
2365039d
|
Michal Schwob
|
import {useRoute} from "@react-navigation/native"
|
3 |
1abbf06f
|
František Kaiser
|
import {Dimensions} from "react-native"
|
4 |
|
|
import React from "react"
|
5 |
|
|
import {AntDesign} from "@expo/vector-icons"
|
6 |
2365039d
|
Michal Schwob
|
|
7 |
|
|
type MenuComponentProps = {
|
8 |
|
|
navigation: any
|
9 |
|
|
}
|
10 |
|
|
|
11 |
1abbf06f
|
František Kaiser
|
const screenWidth = Dimensions.get('window').width; // Get full screen width
|
12 |
|
|
|
13 |
|
|
|
14 |
2365039d
|
Michal Schwob
|
const MenuComponent = (props: MenuComponentProps) => {
|
15 |
|
|
const route = useRoute().name
|
16 |
|
|
|
17 |
|
|
return (
|
18 |
|
|
<>
|
19 |
1abbf06f
|
František Kaiser
|
<Menu w={screenWidth} mt={2} shadow={"0"} color={"primary.500"} backgroundColor={"white"} trigger={ triggerProps => {
|
20 |
2365039d
|
Michal Schwob
|
return <Pressable accessibilityLabel="More options menu" { ...triggerProps }>
|
21 |
1abbf06f
|
František Kaiser
|
<HamburgerIcon color={"primary.500"} size={"lg"}/>
|
22 |
2365039d
|
Michal Schwob
|
</Pressable>
|
23 |
|
|
|
24 |
|
|
} }>
|
25 |
1abbf06f
|
František Kaiser
|
<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>
|
106 |
2365039d
|
Michal Schwob
|
|
107 |
|
|
</Menu>
|
108 |
|
|
</>
|
109 |
|
|
)
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
export default MenuComponent
|