UNPKG

gridcellx

Version:

GridCell component for React, written in TypeScript

84 lines (83 loc) 3.11 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var GridCell_css_1 = require("./GridCell.css"); var React = require("react"); var getCol = function (span) { switch (span) { case 1: return GridCell_css_1.default.col1; case 2: return GridCell_css_1.default.col2; case 3: return GridCell_css_1.default.col3; case 4: return GridCell_css_1.default.col4; case 5: return GridCell_css_1.default.col5; case 6: return GridCell_css_1.default.col6; case 7: return GridCell_css_1.default.col7; case 8: return GridCell_css_1.default.col8; case 9: return GridCell_css_1.default.col9; case 10: return GridCell_css_1.default.col10; case 11: return GridCell_css_1.default.col11; case 12: return GridCell_css_1.default.col12; case 13: return GridCell_css_1.default.col13; case 14: return GridCell_css_1.default.col14; case 15: return GridCell_css_1.default.col15; case 16: return GridCell_css_1.default.col16; case 17: return GridCell_css_1.default.col17; case 18: return GridCell_css_1.default.col18; case 19: return GridCell_css_1.default.col19; case 20: return GridCell_css_1.default.col20; case 21: return GridCell_css_1.default.col21; case 22: return GridCell_css_1.default.col22; case 23: return GridCell_css_1.default.col23; case 24: return GridCell_css_1.default.col24; default: return GridCell_css_1.default.col; } }; var GCol = /** @class */ (function (_super) { __extends(GCol, _super); function GCol(props) { return _super.call(this, props) || this; } GCol.prototype.render = function () { return (React.createElement("div", { className: getCol(this.props.span), key: this.props.key, style: this.props.inherit ? { padding: "0px" } : {} }, React.createElement("div", { className: GridCell_css_1.default.cell, style: this.props.inherit ? { backgroundColor: "transparent" } : {} }, this.props.children))); }; return GCol; }(React.Component)); exports.GCol = GCol;