This repository was archived by the owner on Sep 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +30
-33
lines changed Expand file tree Collapse file tree 5 files changed +30
-33
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ npm install --save react-contextmenu
2121
2222You need to setup two things:
23231 . The ` ContextMenu `
24- 2 . The ` ContextMenuTrigger `
24+ 2 . The ` ContextMenuTrigger `
2525
2626``` jsx
2727import React from " react" ;
@@ -73,9 +73,8 @@ The styling can be apllied to using following classes.
7373- ` react-contextmenu ` : applied to menu root element.
7474- ` react-contextmenu--visible ` : applied to menu root element when visible.
7575- ` react-contextmenu-item ` : applied to menu items.
76- - ` react-contextmenu-link ` : applied to menu links inside items.
77- - ` react-contextmenu-link--disabled ` : applied to links (title in submenu) when they are disabled.
78- - ` react-contextmenu-link--active ` : applied to title in submenu when submenu is open.
76+ - ` react-contextmenu-item--active ` : applied to menu items and title in submenu when submenu is open.
77+ - ` react-contextmenu-item--disabled ` : applied to menu items and title in submenu when they are disabled.
7978- ` react-contextmenu-wrapper ` : applied to wrapper around elements in ` ContextMenuTrigger ` .
8079- ` react-contextmenu-submenu ` : applied to items that are submenus.
8180
Original file line number Diff line number Diff line change 1919 pointer-events : auto;
2020}
2121
22- .react-contextmenu-link {
23- display : inline-block;
24- width : 100% ;
22+ .react-contextmenu-item {
23+ width : 200px ;
2524 padding : 3px 20px ;
26- clear : both;
2725 font-weight : 400 ;
2826 line-height : 1.5 ;
2927 color : # 373a3c ;
3028 text-align : inherit;
3129 white-space : nowrap;
3230 background : 0 0 ;
3331 border : 0 ;
32+ cursor : pointer;
3433}
3534
36- .react-contextmenu-link . active ,
37- .react-contextmenu-link : hover {
35+ .react-contextmenu-item . react-contextmenu-item-- active,
36+ .react-contextmenu-item : hover {
3837 color : # fff ;
3938 background-color : # 0275d8 ;
4039 border-color : # 0275d8 ;
4140 text-decoration : none;
4241}
43- .react-contextmenu-item .submenu > a {
44- padding-right : 27px ;
42+
43+ .react-contextmenu-item .react-contextmenu-submenu {
44+ padding : 0 ;
45+ }
46+
47+ .react-contextmenu-item .react-contextmenu-submenu > .react-contextmenu-item {
4548}
4649
47- .react-contextmenu-item .submenu > a : after {
50+ .react-contextmenu-item .react-contextmenu- submenu > . react-contextmenu-item : after {
4851 content : "▶" ;
4952 display : inline-block;
5053 position : absolute;
Original file line number Diff line number Diff line change @@ -39,17 +39,14 @@ export default class MenuItem extends Component {
3939
4040 render ( ) {
4141 const { disabled, children, attributes } = this . props ;
42- const menuItemClassNames = cx ( cssClasses . menuItem , attributes && attributes . className ) ;
43-
44- const linkClasses = cx ( cssClasses . menuLink , {
45- [ cssClasses . menuLinkDisabled ] : disabled
42+ const menuItemClassNames = cx ( cssClasses . menuItem , attributes && attributes . className , {
43+ [ cssClasses . menuItemDisabled ] : disabled
4644 } ) ;
4745
4846 return (
49- < div { ...attributes } className = { menuItemClassNames } onTouchEnd = { this . handleClick } onClick = { this . handleClick } >
50- < a href = '#' className = { linkClasses } >
51- { children }
52- </ a >
47+ < div { ...attributes } className = { menuItemClassNames }
48+ onTouchEnd = { this . handleClick } onClick = { this . handleClick } >
49+ { children }
5350 </ div >
5451 ) ;
5552 }
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ export default class SubMenu extends Component {
134134 render ( ) {
135135 const { children, disabled, title } = this . props ;
136136 const { visible } = this . state ;
137- const menuItemProps = {
137+ const menuProps = {
138138 ref : this . menuRef ,
139139 onMouseEnter : this . handleMouseEnter ,
140140 onMouseLeave : this . handleMouseLeave ,
@@ -143,11 +143,10 @@ export default class SubMenu extends Component {
143143 position : 'relative'
144144 }
145145 } ;
146- const menuLinkProps = {
147- href : '#' ,
148- className : cx ( cssClasses . menuLink , {
149- [ cssClasses . menuLinkDisabled ] : disabled ,
150- [ cssClasses . menuLinkActive ] : visible
146+ const menuItemProps = {
147+ className : cx ( cssClasses . menuItem , {
148+ [ cssClasses . menuItemDisabled ] : disabled ,
149+ [ cssClasses . menuItemActive ] : visible
151150 } ) ,
152151 onClick : this . handleClick
153152 } ;
@@ -162,10 +161,10 @@ export default class SubMenu extends Component {
162161 } ;
163162
164163 return (
165- < nav { ...menuItemProps } >
166- < a { ...menuLinkProps } >
164+ < nav { ...menuProps } >
165+ < div { ...menuItemProps } >
167166 { title }
168- </ a >
167+ </ div >
169168 < nav { ...subMenuProps } >
170169 { children }
171170 </ nav >
Original file line number Diff line number Diff line change @@ -15,9 +15,8 @@ export const cssClasses = {
1515 menuVisible : 'react-contextmenu--visible' ,
1616 menuWrapper : 'react-contextmenu-wrapper' ,
1717 menuItem : 'react-contextmenu-item' ,
18- menuLink : 'react-contextmenu-link' ,
19- menuLinkActive : 'react-contextmenu-link--active' ,
20- menuLinkDisabled : 'react-contextmenu-link--disabled' ,
18+ menuItemActive : 'react-contextmenu-item--active' ,
19+ menuItemDisabled : 'react-contextmenu-item--disabled' ,
2120 subMenu : 'react-contextmenu-submenu'
2221} ;
2322
You can’t perform that action at this time.
0 commit comments