h5-menudropdown
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "h5-menudropdown", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/h5-menudropdown.js", |
@@ -13,9 +13,51 @@ var React = require('react'); | ||
render: function () { | ||
var total_actions = Object.keys(this.props.actions); | ||
var class_position = this.props.icon.split(' '); | ||
class_position = class_position[class_position.length-1]; | ||
var style_desktop = { | ||
marginTop: - total_actions.length * 33 + "px !important", | ||
marginLeft: -20 + "px !important" | ||
var menu = Object.keys(this.props.actions); | ||
var altura_menu = menu.length * 33; | ||
var _body = document.querySelector("body"); | ||
var largura_body = _body.offsetWidth; | ||
var altura_body = _body.offsetHeight; | ||
var icon = this.props.icon.split(' '); | ||
var _icon = document.querySelector("." + icon[1]); | ||
var left_icon; | ||
var top_icon; | ||
var largura_icon; | ||
var altura_icon; | ||
var style; | ||
if(_icon){ | ||
left_icon = _icon.offsetLeft; | ||
top_icon = _icon.offsetTop; | ||
largura_icon = _icon.offsetWidth; | ||
altura_icon = _icon.offsetHeight; | ||
} | ||
if(top_icon <= (altura_body/2) && left_icon <= (largura_body/2)){ | ||
style = { | ||
left: left_icon, | ||
top: top_icon + altura_icon, | ||
position: 'absolute' | ||
} | ||
} | ||
if(top_icon > (altura_body/2) && left_icon <= (largura_body/2)){ | ||
style = { | ||
left: left_icon, | ||
top: top_icon - altura_menu, | ||
position: 'absolute' | ||
} | ||
} | ||
if(top_icon <= (altura_body/2) && left_icon >= (largura_body/2)){ | ||
style = { | ||
left: left_icon - 164, | ||
top: top_icon + altura_icon, | ||
position: 'absolute' | ||
} | ||
} | ||
if(top_icon > (altura_body/2) && left_icon >= (largura_body/2)){ | ||
style = { | ||
left: left_icon - 164, | ||
top: top_icon - altura_menu, | ||
position: 'absolute' | ||
} | ||
} | ||
return (React.createElement("div", {}, [React.createElement("icon", { | ||
@@ -25,3 +67,3 @@ className: this.props.icon + " icon_details ", | ||
}), | ||
this.isDropDown() ? React.createElement("div", {className: class_position, style: style_desktop}, [this.createItensMenu()]) : null | ||
this.isDropDown() ? React.createElement("div", {style: style}, [this.createItensMenu()]) : null | ||
])); | ||
@@ -28,0 +70,0 @@ }, |
@@ -26,3 +26,3 @@ var React = require('react'); | ||
//var mock_store = { | ||
// menu: [___fields___] | ||
// menu: [__fields___] | ||
//}; | ||
@@ -29,0 +29,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
913229
3905