{"size": 1157, "ext": "js", "max_stars_repo_path": "src/components/LayerList/LayerActionsMenu.js", "max_stars_repo_name": "cartolab-gis/elements", "max_stars_repo_stars_event_min_datetime": "2019-12-18T22:51:05.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-05T16:29:56.000Z", "max_issues_repo_path": "src/components/LayerList/LayerActionsMenu.js", "max_issues_repo_name": "cartolab-gis/elements", "max_issues_repo_issues_event_min_datetime": "2019-12-20T04:15:03.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-15T17:31:26.000Z", "max_forks_repo_path": "src/components/LayerList/LayerActionsMenu.js", "max_forks_repo_name": "cartolab-gis/elements", "max_forks_repo_forks_event_min_datetime": "2019-12-19T14:26:26.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-07T04:46:55.000Z"}
{"max_stars_count": 66, "max_issues_count": 9, "max_forks_count": 11, "avg_line_length": 22.6862745098, "max_line_length": 60, "alphanum_fraction": 0.4356093345}
/** @jsxImportSource theme-ui */
import {
  Menu,
  MenuButton,
  MenuItem,
  MenuPopover,
  MenuItems
} from '@reach/menu-button';
import '@reach/menu-button/styles.css';

const LayerActionsMenu = ({ layerActions }) => {
  if (layerActions && layerActions.length > 0) {
    return (
      <Menu className="cl-layer-list-action-menu">
        <MenuButton
          sx={{
            color: 'text',
            bg: 'background',
            borderStyle: 'none',
            fontSize: 1,
            ':hover': {
              cursor: 'pointer'
            }
          }}
        >
          ...
        </MenuButton>
        <MenuPopover sx={{ zIndex: 3, fontFamily: 'body' }}>
          <MenuItems>
            {layerActions.map((action) => {
              return (
                <MenuItem
                  key={action.title}
                  onSelect={() => {
                    action.action();
                  }}
                >
                  {action.title}
                </MenuItem>
              );
            })}
          </MenuItems>
        </MenuPopover>
      </Menu>
    );
  }
  return null;
};

export default LayerActionsMenu;
