1 |
2365039d
|
Michal Schwob
|
import {HamburgerIcon, Pressable, Menu, Text, Icon, ChevronRightIcon, HStack} from "native-base"
|
2 |
|
|
import {useRoute} from "@react-navigation/native"
|
3 |
|
|
|
4 |
|
|
type MenuComponentProps = {
|
5 |
|
|
navigation: any
|
6 |
|
|
}
|
7 |
|
|
|
8 |
|
|
const MenuComponent = (props: MenuComponentProps) => {
|
9 |
|
|
const route = useRoute().name
|
10 |
|
|
|
11 |
|
|
return (
|
12 |
|
|
<>
|
13 |
|
|
<Menu w="190" color={"primary.500"} trigger={ triggerProps => {
|
14 |
|
|
return <Pressable accessibilityLabel="More options menu" { ...triggerProps }>
|
15 |
|
|
<HamburgerIcon color={"primary.500"}/>
|
16 |
|
|
</Pressable>
|
17 |
|
|
|
18 |
|
|
} }>
|
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 |
d5dd3956
|
Michal Schwob
|
<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 |
2365039d
|
Michal Schwob
|
<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>
|
75 |
|
|
|
76 |
|
|
</Menu>
|
77 |
|
|
</>
|
78 |
|
|
)
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
export default MenuComponent
|