@zohodesk/components
Version:
Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development
60 lines (54 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = useDropboxPosCalc;
var _Common = require("../../utils/Common");
function useDropboxPosCalc(props) {
var right = props.right,
left = props.left,
top = props.top,
arrowRight = props.arrowRight,
arrowLeft = props.arrowLeft,
arrowTop = props.arrowTop,
arrowBottom = props.arrowBottom,
bottom = props.bottom,
isModel = props.isModel,
direction = props.direction;
var unit = 'rem';
var boxstyle = {};
var arrowstyle = {};
var needBoxStyle = right || left || top || bottom;
var needArrowStyle = arrowLeft || arrowRight || arrowTop || arrowBottom;
if (needBoxStyle) {
boxstyle = !isModel ? direction === 'rtl' ? {
right: [(0, _Common.remConvert)(left)] + unit,
left: [(0, _Common.remConvert)(right)] + unit,
top: [(0, _Common.remConvert)(top)] + unit,
bottom: [(0, _Common.remConvert)(bottom)] + unit
} : {
right: [(0, _Common.remConvert)(right)] + unit,
left: [(0, _Common.remConvert)(left)] + unit,
top: [(0, _Common.remConvert)(top)] + unit,
bottom: [(0, _Common.remConvert)(bottom)] + unit
} : {};
}
if (needArrowStyle) {
arrowstyle = !isModel ? direction === 'rtl' ? {
right: [(0, _Common.remConvert)(arrowLeft)] + unit,
left: [(0, _Common.remConvert)(arrowRight)] + unit,
top: [(0, _Common.remConvert)(arrowTop)] + unit,
bottom: [(0, _Common.remConvert)(arrowBottom)] + unit
} : {
right: [(0, _Common.remConvert)(arrowRight)] + unit,
left: [(0, _Common.remConvert)(arrowLeft)] + unit,
top: [(0, _Common.remConvert)(arrowTop)] + unit,
bottom: [(0, _Common.remConvert)(arrowBottom)] + unit
} : {};
}
return {
needBoxStyle: needBoxStyle,
boxstyle: boxstyle,
arrowstyle: arrowstyle
};
}