myprojectpackageprav
Version:
My package in npm
82 lines • 5.92 kB
JavaScript
import { __assign } from "tslib";
import { useState, useRef, useEffect } from "react";
import ActionButtons from '../buttons/actionbutton';
import "./helpdesk.css";
var popupTop = '';
var xpositionvalue = '';
var offsetLeftValue = '';
var offsetTopValue = '';
var elementHeightValue = '';
var offsetWidthValue = '';
export default function Helpdesk() {
/***** Responsive Popup Code Start*****/
var helpdesk = useRef(null);
var popupbtnRef = useRef(null);
var _a = useState(''), xpositionvalueupdate = _a[0], setpopupwidthupdate = _a[1];
var _b = useState(1), popupheight = _b[0], setpopupheight = _b[1];
var _c = useState({
helpdesk: false,
}), showActionPopups = _c[0], setShowActionPopups = _c[1];
var initialValues = ['helpdesk'];
var _d = useState({
helpdesk: false,
}), btnActionshowhide = _d[0], setActionbtnshowhide = _d[1];
useEffect(function () {
setpopupheight(window.innerHeight - (offsetTopValue + 58));
var popupwidthdata = popupbtnRef.current ? popupbtnRef.current.offsetWidth : 0;
// setpopupwidth(popupwidthdata)
if (popupwidthdata < xpositionvalue) {
xpositionvalue = xpositionvalue - popupwidthdata;
setpopupwidthupdate(xpositionvalue);
}
else if (popupwidthdata > offsetLeftValue && popupwidthdata < (window.innerWidth - (offsetLeftValue + offsetWidthValue))) {
xpositionvalue = offsetLeftValue;
setpopupwidthupdate(xpositionvalue);
}
else if (popupwidthdata > offsetLeftValue && popupwidthdata > (window.innerWidth - (offsetLeftValue + offsetWidthValue))) {
xpositionvalue = 0;
setpopupwidthupdate(xpositionvalue);
}
}, [showActionPopups]);
var showhide = __assign({}, btnActionshowhide);
function popupCloseOpenFunctionality(type, value, top, xposition, left, Ref, elementHeight, offsetWidth) {
var _a, _b;
popupTop = top;
xpositionvalue = xposition;
offsetLeftValue = left;
offsetTopValue = top;
elementHeightValue = elementHeight;
offsetWidthValue = offsetWidth;
initialValues.forEach(function (element) {
showhide[element] = false;
});
setActionbtnshowhide(showhide);
if (type) {
setActionbtnshowhide(__assign(__assign({}, showhide), (_a = {}, _a[type] = value, _a)));
setShowActionPopups(__assign(__assign({}, showhide), (_b = {}, _b[type] = value, _b)));
}
}
return (React.createElement(React.Fragment, null,
React.createElement("div", { className: "help-desk" },
React.createElement("div", { className: "mx-2" },
React.createElement(ActionButtons, { label: "Help Desk", name: 'Help Desk', className: (btnActionshowhide === null || btnActionshowhide === void 0 ? void 0 : btnActionshowhide.helpdesk) ? 'btn-border btn btn-sm font-0 font-md-14 btn-border-radius3 p-relative popup-arrow' : 'btn-border btn btn-sm font-0 font-md-14 btn-border-radius3 p-relative', icon: "icon-helpdesk color-primary font-16 me-md-1 bold", isClick: 'helpdesk', type: "button", ref: helpdesk, popupCloseOpenFunctionality: popupCloseOpenFunctionality, showhide: showActionPopups.helpdesk, id: undefined, props: undefined, inputProps: undefined, onClick: undefined, reference: undefined, btnclassName: undefined, badgeinfo: undefined, badge: undefined, ricon: undefined, "aria-label": undefined })),
(btnActionshowhide === null || btnActionshowhide === void 0 ? void 0 : btnActionshowhide.helpdesk) ?
React.createElement("div", { className: 'popup p-relative', ref: popupbtnRef, style: { top: popupTop + 8, position: "absolute", overflow: "auto", left: xpositionvalueupdate, maxHeight: popupheight } },
React.createElement("div", { className: "p-relative" },
React.createElement("h3", { tabIndex: 0, "aria-lable": "System Help Desk" }, "System Help Desk"),
React.createElement("div", { className: "pt-2 d-flex align-items-center", id: "helpdesk-timings", tabIndex: 0, "aria-aria-labelledby": "helpdesk-timings" },
React.createElement("div", { className: "icon-timing me-1" }),
React.createElement("div", null,
React.createElement("p", { className: "font-12 subtitle-color1" }, "Hours of operation:"),
React.createElement("p", null, "8 AM - 6 PM EST "))),
React.createElement("p", { className: "d-flex align-items-center pt-2" },
React.createElement("span", { className: "icon-mail me-1" }),
React.createElement("a", { title: "info@rhybus.com", href: "mailto:info@rhybus.com", className: "links" }, "info@rhybus.com")),
React.createElement("p", { className: "d-flex align-items-center pt-2" },
React.createElement("span", { className: "icon-phone me-1" }),
React.createElement("a", { title: "(123)555-6789", href: "tel:(123)555-6789" }, "(123)555-6789")),
React.createElement("div", { className: 'close' },
React.createElement(ActionButtons, { label: "Cancel", name: "", className: 'btn-bgcolor6 whitetext p-0 btn btn-sm font-0 btn-border-radius3', icon: "icon-close font-8 p-1", type: "button", isClick: 'helpdesk', ref: helpdesk, popupCloseOpenFunctionality: popupCloseOpenFunctionality, showhide: showActionPopups.helpdesk, id: undefined, props: undefined, inputProps: undefined, onClick: undefined, reference: undefined, btnclassName: undefined, badgeinfo: undefined, badge: undefined, ricon: undefined, "aria-label": undefined }))))
: '')));
}
//# sourceMappingURL=helpdesk.js.map