0.3.5 • Published 8 years ago

swipes-dot v0.3.5

Weekly downloads
16
License
MIT
Repository
github
Last release
8 years ago

##The Swipes dot and radial contextual menu

###Instalation

npm install swipes-dot --save

###Usage

import React from 'react';
import SwipesDot from 'swipes-dot';

// for radial menu
const elements = [
  {
    label: 'Done',
    icon: 'check',
    callback() {
      console.log('Done!');
    }
  }
]

// for grid menu
const elements = [
  [
    {
      label: 'Done',
      icon: 'check',
      bgColor: 'green',
      callback() {
        console.log('Done!');
      }
    }
  ]
]

<SwipesDot
  hoverParentId='parentId'
  elements={elements} />

###Required attributes

hoverParentId - the id of the element you want to activate the first stage of the dot on mouse over.

elements - the element that are going to be rendered in the radial menu. Every element consists:

  • label - string that explains the action

  • icon - string with a name of a material design icon

  • bgColor - set the background color of the cell (only for the grid menu)

  • callback - a callback function that will be called on click of the element.

###Optional attributes

radial - boolean defaults the false. Set it to true to have the radial menu.

reverse - boolean defaults the false. Set it to true to have the menu items on the left side of the dot.

showOnHover - boolean defaults the false. Set it to true to have the dot hidden until the parent is hovered.

onDragStart - a callback function that will be called when the user started dragging the dot.

style - inline styles for the root element

###Optional attributes for testing purposes menuColors - This is just for testing the colors for the menu items until we find the right ones. Here is an example:

{
  borderColor: 'red',
  hoverBorderColor: '#333ddd',
  backgroundColor: 'white',
  hoverBackgroundColor: 'transparent',
  iconColor: '#333ddd',
  hoverIconColor: 'red'
}

labelStyles - inline styles for the label

###Dev environment

npm install

npm install
cd example
npm install

Make an npm link From the root directory call npm link.

From example directory call npm link swipes-dot.

Build

From the root directory call grunt run - to watch for changes in the src directory and build in lib.

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago