2019-12-02 10:19:32 +05:00
|
|
|
import React from "react";
|
|
|
|
|
import { Flex, Box, Text } from "rebass";
|
|
|
|
|
import { SHADOW } from "../../theme";
|
|
|
|
|
|
|
|
|
|
function Menu(props) {
|
|
|
|
|
return (
|
|
|
|
|
<Flex
|
|
|
|
|
bg="primary"
|
|
|
|
|
py={1}
|
|
|
|
|
sx={{ borderRadius: "default", boxShadow: SHADOW }}
|
|
|
|
|
>
|
|
|
|
|
<Box>
|
|
|
|
|
{props.menuItems.map(item => (
|
|
|
|
|
<Flex
|
2019-12-02 10:28:54 +05:00
|
|
|
key={item.title}
|
2019-12-02 10:19:32 +05:00
|
|
|
onClick={() => {
|
|
|
|
|
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": {
|
|
|
|
|
backgroundColor: "accent",
|
|
|
|
|
color: "fontSecondary"
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
>
|
2019-12-02 10:28:54 +05:00
|
|
|
<item.icon size={15} strokeWidth={1.5} />
|
2019-12-02 10:19:32 +05:00
|
|
|
<Text
|
|
|
|
|
className="unselectable"
|
|
|
|
|
as="span"
|
|
|
|
|
mx={1}
|
|
|
|
|
fontFamily="body"
|
|
|
|
|
fontSize="menu"
|
|
|
|
|
>
|
|
|
|
|
{item.title}
|
|
|
|
|
</Text>
|
|
|
|
|
</Flex>
|
|
|
|
|
))}
|
|
|
|
|
</Box>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
export default Menu;
|