main
js 38 lines 684 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 import * as React from 'react';
11
12 import styles from './ContextMenuItem.css';
13
14 type Props = {
15 children: React.Node,
16 onClick: () => void,
17 hide: () => void,
18 };
19
20 export default function ContextMenuItem({
21 children,
22 onClick,
23 hide,
24 }: Props): React.Node {
25 const handleClick = () => {
26 onClick();
27 hide();
28 };
29
30 return (
31 <div
32 className={styles.ContextMenuItem}
33 onClick={handleClick}
34 onTouchEnd={handleClick}>
35 {children}
36 </div>
37 );
38 }