UNPKG

@helpscout/artboard

Version:

A tool kit for React UI development and design

71 lines 3.03 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var react_redux_1 = require("react-redux"); var GuideContainer_1 = require("../../GuideContainer"); var Guide_1 = require("../../Guide"); var ArtboardGuides = /** @class */ (function (_super) { __extends(ArtboardGuides, _super); function ArtboardGuides() { return _super !== null && _super.apply(this, arguments) || this; } ArtboardGuides.prototype.render = function () { var _a = this.props, guides = _a.guides, withCenterGuides = _a.withCenterGuides; var guidesMarkup = guides; if (Array.isArray(guides)) { guidesMarkup = guides.map(function (item, index) { var key = "guide-" + index; var props = item.props ? item.props : item; if (typeof item === 'object') { return React.createElement(Guide_1.default, __assign({}, props, { key: key })); } return null; }); } return (React.createElement(GuideContainer_1.default, { position: "absolute", top: "0", left: "0", width: "100%", height: "100%", zIndex: 999999 }, guidesMarkup, withCenterGuides && [ React.createElement(Guide_1.default, { top: "50%", width: "100%", height: 1, showValues: false, key: "cross1" }), React.createElement(Guide_1.default, { left: "50%", height: "100%", width: 1, showValues: false, key: "cross2" }), ])); }; ArtboardGuides.defaultProps = { guides: [], withCenterGuides: true, }; return ArtboardGuides; }(React.Component)); exports.ArtboardGuides = ArtboardGuides; var mapStateToProps = function (state) { var guides = state.guides, withCenterGuides = state.withCenterGuides; return { guides: guides, withCenterGuides: withCenterGuides, }; }; exports.default = react_redux_1.connect(mapStateToProps)(ArtboardGuides); //# sourceMappingURL=Artboard.Guides.js.map