MCPcopy Create free account
hub / github.com/async-labs/async / render

Method render

app/components/common/MenuWithMenuItems.tsx:14–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12 };
13
14 public render() {
15 const { menuOptions, itemOptions, inline = false } = this.props;
16 const { menuElm } = this.state;
17
18 return (
19 <div style={{ verticalAlign: 'middle', display: inline ? 'inline' : 'inherit' }}>
20 {!menuOptions.text ? (
21 <i
22 aria-owns={menuElm ? menuOptions.id : null}
23 data-id={menuOptions.dataId}
24 aria-haspopup="true"
25 style={{ fontSize: '16px', opacity: 0.7, cursor: 'pointer', verticalAlign: 'middle' }}
26 className="material-icons"
27 onClick={(e) => this.handleClick(e)}
28 >
29 more_vert
30 </i>
31 ) : (
32 <React.Fragment>
33 <span onClick={(e) => this.handleClick(e)}>
34 {menuOptions.text}{' '}
35 <i className="material-icons" color="action" style={{ verticalAlign: 'bottom' }}>
36 arrow_drop_down
37 </i>
38 </span>
39 </React.Fragment>
40 )}
41
42 <Menu
43 id={menuOptions.id}
44 anchorEl={menuElm}
45 open={Boolean(menuElm)}
46 onClose={this.handleClose}
47 >
48 {itemOptions.map((option, i) => (
49 <MenuItem
50 key={option.dataId + i}
51 data-id={option.dataId}
52 data-more-id={option.dataMoreId}
53 onClick={(e) => {
54 this.setState({ menuElm: null });
55 option.onClick(e);
56 }}
57 >
58 {option.text}
59 </MenuItem>
60 ))}
61 </Menu>
62 </div>
63 );
64 }
65
66 private handleClick = (event) => {
67 event.preventDefault();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected