Files
notesnook/apps/web/src/components/menu/index.js

57 lines
1.3 KiB
JavaScript
Raw Normal View History

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": {
2019-12-11 00:07:32 +05:00
backgroundColor: "primary",
2019-12-02 10:19:32 +05:00
color: "fontSecondary"
}
}}
>
<Text
className="unselectable"
as="span"
mx={1}
fontFamily="body"
fontSize="menu"
>
{item.title}
</Text>
</Flex>
))}
</Box>
</Flex>
);
}
export default Menu;