1.0.33 • Published 6 years ago

react-revolver-menu v1.0.33

Weekly downloads
7
License
BSD
Repository
github
Last release
6 years ago

react revolver menu

WIP

The React Revolver Menu is an arbitrarily deep menu React Component Items are arranged in a circle and all subsequent items will replace previous items in the circle. A 'back' button appears in the center of the menu if there are previous items in the hierarchy;

See it in action here

Props

items : PropTypes.arrayOf(PropTypes.shape({
  type              : PropTypes.oneOf(['img', 'icon', 'text']).isRequired,
  text              : PropTypes.string,
  src               : PropTypes.string,
  icon              : PropTypes.string,
  className         : PropTypes.string,
  popover           : PropTypes.string,
  popoverPosition   : PropTypes.oneOf(['bottom', 'top', 'right', 'left']),
  items             : PropTypes.arrayOf(PropTypes.object),
  onClick           : PropTypes.func,
})).isRequired,
diameter     : PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
animateDelay : PropTypes.number,
animateStyle : PropTypes.oneOf(['radiate', 'swing']),
border       : PropTypes.oneOf(['dashed', 'solid', 'none'])

items (required)

Array of objects that signify the items in the menu Each item has can have an optional array of items that are the next level of the menu when the item is clicked.

type (required)

string - either img, icon, text

text

string - Text to display as menu item. Required if type = text.

src

string - Url of image. Required if type = img.

icon

string - font-awesome icon className. Required if type = icon.

className

string - optional className for the item

popover

string - optional popover text on item hover

popover

string - optional popover position - either top, bottom, right, or left

items

array - array of item objects - sub-items when item is clicked

onClick

function - callback called when item is clicked

diameter

diameter of the menu, can me a number (in pixels) or a string (eg. 300px)

animateDelay

the delay between each item in menu showing during transitions

animateStyle

either 'radiate' or 'swing' - type of transition between menu sub-items

border

either 'dashed', 'solid', 'none', or none - type of border around the menu

Usage

npm install react-revolver-menu

Get the AMD module located at react-revolver-menu.js and include it in your project.

Here is a sample integration:

require.config({
  paths: {
    'react': 'vendor/bower_components/react/react',
    'ReactRevolverMenu': 'react-revolver-menu'
  }
});

require(['react', 'ReactRevolverMenu'], function(React, ReactRevolverMenu) {

  React.render(React.createElement(ReactRevolverMenu), document.getElementById('widget-container'));

});

Development

  • clone repo && npm install
  • Development server npm start.
  • Continuously run tests on file changes npm run watch-test;
  • Run tests: npm test;
  • Build npm run build;
1.0.33

6 years ago

1.0.32

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago