All Projects → lwhiteley → react-push-menu

lwhiteley / react-push-menu

Licence: MIT license
react multi level push menu

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to react-push-menu

Menus
📌 Menu generator package for the Laravel framework
Stars: ✭ 133 (+259.46%)
Mutual labels:  menus
PushNotifications
Push Notification using Embarcadero Rad Studio Tokyo 10.2.3 on Android and Apple Devices written in C++ and Delphi
Stars: ✭ 12 (-67.57%)
Mutual labels:  push
ejabberd mod gcm
Google Cloud Messaging API for Ejabberd (PUSH Messages)
Stars: ✭ 27 (-27.03%)
Mutual labels:  push
Vue Dock Menu
⚓Dockable Menu bar for Vue
Stars: ✭ 183 (+394.59%)
Mutual labels:  menus
hms-push-serverdemo-java
Java sample code encapsulates APIs of the HUAWEI Push Kit server. It provides many sample programs for your reference or usage.
Stars: ✭ 39 (+5.41%)
Mutual labels:  push
hms-push-serverdemo-php
PHP sample code encapsulates APIs of the HUAWEI Push Kit server.It provides many sample PHP programs about quick access to HUAWEI Push Kit for your reference or usage.
Stars: ✭ 21 (-43.24%)
Mutual labels:  push
Nova Menu Builder
This Laravel Nova package allows you to create and manage menus and menu items.
Stars: ✭ 112 (+202.7%)
Mutual labels:  menus
homebridge-http-rgb-push
Homebridge plugin to control a web/http-based RGB device.
Stars: ✭ 16 (-56.76%)
Mutual labels:  push
umi-plugin-menus
将 umi 生成的 routes 转换成 tree 结构 menus 数据,开发中可直接引入该文件来进行导航菜单的生成
Stars: ✭ 29 (-21.62%)
Mutual labels:  menus
applink
A simple router based on scheme for Android
Stars: ✭ 21 (-43.24%)
Mutual labels:  push
Magento2 Menu
Provides powerful menu editor to replace category based menus in Magento 2
Stars: ✭ 184 (+397.3%)
Mutual labels:  menus
PolishAnnoyanceFilters
Polskie Filtry Elementów Irytujących ukrywają i blokują wyskakujące okienka, widgety, newslettery, powiadomienia push, strzałki, niezgodne z tematem artykułów otagowane linki wewnętrzne i inne drażniące elementy (Polskie Filtry RODO-Ciasteczkowe są już w nich zawarte).
Stars: ✭ 45 (+21.62%)
Mutual labels:  push
mobile-messaging-sdk-android
Mobile Messaging SDK for Android
Stars: ✭ 40 (+8.11%)
Mutual labels:  push
Smenu
smenu started as a lightweight and flexible terminal menu generator, but quickly evolved into a powerful and versatile CLI selection tool for interactive or scripting use.
Stars: ✭ 1,906 (+5051.35%)
Mutual labels:  menus
ngx-stream-request-module
基于ngx-stream-module 实现长连接的处理,把长连接数据按照使用的协议转切分为请求(request),与后端服务器使用短连接通讯,完全兼容后端http协议。后端服务器使用推送协议可以很方便的把数据推送到客户端。
Stars: ✭ 15 (-59.46%)
Mutual labels:  push
Menu
A JavaScript free menu library for Blazor and Razor Components applications.
Stars: ✭ 118 (+218.92%)
Mutual labels:  menus
RAGENativeUI
No description or website provided.
Stars: ✭ 95 (+156.76%)
Mutual labels:  menus
fcmpush
Firebase Cloud Messaging API wrapper for Ruby, suppot HTTP v1 API including access_token auto refresh feature.
Stars: ✭ 44 (+18.92%)
Mutual labels:  push
browser-push
Complete workout and guidelines to add web push notifications support for your webapp without third-party notification provider
Stars: ✭ 67 (+81.08%)
Mutual labels:  push
umeng analytics push
Umeng Analytics&Push Flutter Plugins
Stars: ✭ 28 (-24.32%)
Mutual labels:  push

react-push-menu

Notice: There are breaking changes. Do not upgrade from v1.* if you do not intend to adjust the interfaces seen below. The interface to manage the menu has changed. Please see the examples below

npm version

Prerequisites

Install peer dependencies

npm install react react-dom styled-components --save

Install

npm install --save react-push-menu

How to use

import { PushMenu, usePushMenu } from 'react-push-menu';
import { FaChevronRight, FaChevronLeft } from 'react-icons/fa';

function Content() {
  const { toggleMenu } = usePushMenu();
  return (
    <div
      onClick={() => {
        toggleMenu();
      }}
    >
      trigger
    </div>
  );
}

/* ... */

function App() {
  return (
    <PushMenu
      backIcon={<FaChevronLeft />}
      expanderComponent={FaChevronRight}
      nodes={menuData}
      propMap={{ url: 'link' }}
    >
      <Content />
    </PushMenu>
  );
}

See example for more details

Properties

openOnMount (boolean)

This option allows you to initialize the push menu as open on load.

nodes (Object)

This property accepts an object with the definition for the menu. see the example for a sample menu definition

propMap (Object)

APIs can define/give a different structure or property names for required fields. This give the user the option to tell react-push-menu which property on the node/menu item to find the value it's looking for.

Mapping Description
id the id property of the node
displayName This is the text that will appear in the menu option.
linkClasses These are class names that will be added to the menu option.
expanderClasses These are class names that will be added to the menu option's expander given it has defined children.
url This tells the library which prop the url for the menu item is located. will default to a hash (#) if none is found
childPropName This is the property name that holds the children of each menu item node. We realize that data driven menu may differ and it is important to customize the properties that may hold the required data. default: children

eg.

<PushMenu
  propMap={{
    displayName: 'title',
    id: 'id',
    linkClasses: 'classes',
    expanderClasses: 'expClasses',
    childPropName: 'children',
    url: 'url',
  }}
></PushMenu>

onNodeClick (function)

This is an onClick callback fired when you click the link of a menu item. Please note it won't be fired when you click the expand component for a menu item.

eg.

<PushMenu
  onNodeClick={(e, context) => {
    /**
      {
        // state
        node: Record<string, any>; // the current node
        nodes: Record<string, any>; // full menu tree
        propMap: PropMap;
        visibleMenus: Array;

        // actions
        addMenu: (node) => {};
        removeLastMenu: Function;
        closeMenu: Function;
        openMenu: Function;
        openSubMenu: (node) => {};
        toggleMenu: Function;
      }
     **/
    console.log(context);

    // following line will close the menu completely
    context.closeMenu();
  }}
></PushMenu>

onMenuExpand (function)

This function triggered when a sub menu is expanded.

<PushMenu
  onMenuExpand={(e, context) => {
    // do something
    // return false to prevent default behaviour
  }}
></PushMenu>

linkComponent (React.Component)

You can fully customize the link of the menu by passing in a React Component to this property. It will be instantiated with the data object which contains the current node being interacted with. (props.data). To see an example please see LinkComponent.js

backComponent (React.Component)

You can fully customize the back link of the sub menus by passing in a React Component to this property. It will be instantiated with the data object which contains the current node being interacted with. (props.data).

backIcon (ReactNode)

If you don't specify a backComponent, you can at least need specify an icon to use for the back component

<FaChevronLeft />

expanderComponent (React.Component) (Required)

You can fully customize the expander link of the sub menus by passing in a React Component to this property. The expander is the chevron-right that appears when a menu item has children. It will be instantiated with the data object which contains the current node being interacted with. (props.data).

Notes/Todos

  • add task to deploy to gh-pages
  • add more event handlers

Pull requests are welcome

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].