2019-12-02 10:19:32 +05:00
|
|
|
import React from "react";
|
|
|
|
|
import { Flex, Box, Text } from "rebass";
|
|
|
|
|
|
|
|
|
|
function Menu(props) {
|
|
|
|
|
return (
|
2019-12-19 10:04:46 +05:00
|
|
|
<Flex
|
|
|
|
|
bg="navbg"
|
|
|
|
|
py={1}
|
|
|
|
|
sx={{
|
|
|
|
|
position: "relative",
|
|
|
|
|
borderRadius: "default",
|
|
|
|
|
boxShadow: 2,
|
|
|
|
|
width: 120
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box width="100%" bg="navbg">
|
2019-12-02 10:19:32 +05:00
|
|
|
{props.menuItems.map(item => (
|
|
|
|
|
<Flex
|
2019-12-02 10:28:54 +05:00
|
|
|
key={item.title}
|
2019-12-04 13:13:00 +05:00
|
|
|
onClick={e => {
|
2020-01-06 17:34:45 +05:00
|
|
|
e.stopPropagation();
|
2019-12-02 10:19:32 +05:00
|
|
|
if (props.dropdownRef) {
|
|
|
|
|
props.dropdownRef.hide();
|
|
|
|
|
}
|
|
|
|
|
if (item.onClick) {
|
|
|
|
|
item.onClick(props.data);
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
flexDirection="row"
|
|
|
|
|
alignItems="center"
|
|
|
|
|
py={1}
|
|
|
|
|
px={2}
|
|
|
|
|
sx={{
|
2019-12-02 10:28:54 +05:00
|
|
|
color: item.color || "fontPrimary",
|
2019-12-02 10:19:32 +05:00
|
|
|
":hover": {
|
2020-01-08 14:58:24 +05:00
|
|
|
backgroundColor: "shade"
|
2019-12-02 10:19:32 +05:00
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
>
|
2020-01-08 10:44:51 +05:00
|
|
|
<Text as="span" mx={1} fontFamily="body" fontSize="menu">
|
2019-12-02 10:19:32 +05:00
|
|
|
{item.title}
|
|
|
|
|
</Text>
|
|
|
|
|
</Flex>
|
|
|
|
|
))}
|
|
|
|
|
</Box>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
export default Menu;
|