##The Swipes dot and radial contextual menu
###Instalation
npm install swipes-dot --save
###Usage
import React from 'react';
import SwipesDot from 'swipes-dot';
const elements = [
{
label: 'Done',
icon: 'check',
callback() {
console.log('Done!');
}
}
]
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
.