react-icons/fi#FiTag TypeScript Examples

The following examples show how to use react-icons/fi#FiTag. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextMenu.tsx    From meshtastic-web with GNU General Public License v3.0 5 votes vote down vote up
ContextMenu = ({
  items,
  children,
}: ContextMenuProps): JSX.Element => {
  const [visible, setVisible] = useState(false);
  const [position, setPosition] = useState({ x: 0, y: 0 });

  return (
    <div
      className="h-full"
      onContextMenu={(e): void => {
        e.preventDefault();

        setVisible(false);
        const newPosition = {
          x: e.pageX,
          y: e.pageY,
        };

        setPosition(newPosition);
        setVisible(true);
      }}
      onClick={(): void => {
        setVisible(false);
      }}
    >
      {children}

      {visible && (
        <div
          style={{ top: position.y, left: position.x }}
          className="fixed z-50 w-60 gap-2 divide-y divide-gray-300 rounded-md border border-gray-400 font-medium drop-shadow-md backdrop-blur-xl dark:divide-gray-600 dark:border-gray-600  dark:text-gray-400"
        >
          {items}
          <ContextItem title="Menu item" icon={<FiActivity />} />
          <ContextItem title="Menu item 2" icon={<FiAperture />} />
          <ContextItem
            title="Menu item 3 with a very long name that should wrap"
            icon={<FiTag />}
          />
        </div>
      )}
    </div>
  );
}