summaryrefslogtreecommitdiffstats
path: root/packages/excalidraw/components/dropdownMenu/DropdownMenuItemContent.tsx
blob: 000b8c3441274d4d405744f650ee6b4c1b11fcb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import type { JSX } from "react";
import { useDevice } from "../App";

const MenuItemContent = ({
  textStyle,
  icon,
  shortcut,
  children,
}: {
  icon?: JSX.Element;
  shortcut?: string;
  textStyle?: React.CSSProperties;
  children: React.ReactNode;
}) => {
  const device = useDevice();
  return (
    <>
      {icon && <div className="dropdown-menu-item__icon">{icon}</div>}
      <div style={textStyle} className="dropdown-menu-item__text">
        {children}
      </div>
      {shortcut && !device.editor.isMobile && (
        <div className="dropdown-menu-item__shortcut">{shortcut}</div>
      )}
    </>
  );
};
export default MenuItemContent;