@up-group-ui/react-controls
Version:
Up shared react controls
32 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var TodayLine = (function (_super) {
(0, tslib_1.__extends)(TodayLine, _super);
function TodayLine() {
return _super !== null && _super.apply(this, arguments) || this;
}
TodayLine.prototype.render = function () {
var currentTime = new Date().getTime();
if (currentTime > this.props.canvasTimeStart && currentTime < this.props.canvasTimeEnd) {
var ratio = this.props.canvasWidth / (this.props.canvasTimeEnd - this.props.canvasTimeStart);
var left = Math.round((currentTime - this.props.canvasTimeStart) * ratio);
var top_1 = this.props.headerHeight;
var height = this.props.height - this.props.headerHeight;
var styles = {
top: top_1 + "px",
left: left + "px",
height: height + "px",
};
return (0, jsx_runtime_1.jsx)("div", { className: "rct-today", style: styles }, void 0);
}
else {
return (0, jsx_runtime_1.jsx)("div", {}, void 0);
}
};
return TodayLine;
}(react_1.default.Component));
exports.default = TodayLine;
//# sourceMappingURL=TodayLine.js.map