UNPKG

@raona/components

Version:

React components used at Raona to work with SPFx

49 lines (48 loc) 2.7 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 React = require("react"); var react_1 = require("react"); var spfx_controls_react_1 = require("@pnp/spfx-controls-react"); var Images_1 = require("../../constants/Images"); // TODO: convert to function component var WhatsNewCard = /** @class */ (function (_super) { __extends(WhatsNewCard, _super); function WhatsNewCard() { return _super !== null && _super.apply(this, arguments) || this; } WhatsNewCard.prototype.render = function () { var _a = this.props, item = _a.item, openItemsOnNewPage = _a.openItemsOnNewPage; var path = item.redirectUrl; var splittedPath = path && path.split('/'); var isFolder = splittedPath && splittedPath[splittedPath.length - 1].indexOf('.') < 0; return (React.createElement("div", { className: 'cardC' }, React.createElement("a", { href: item.redirectUrl, target: openItemsOnNewPage ? '_blank' : '_self' }, React.createElement("div", { className: 'cardC__image' }, isFolder ? React.createElement("span", { style: { backgroundImage: "url(\"" + Images_1.Images.folder + "\")" } }) : React.createElement(spfx_controls_react_1.FileTypeIcon, { type: 2, path: path })), React.createElement("div", { className: 'cardC__body' }, React.createElement("p", { className: 'cardC__title' }, item.title), React.createElement("div", null, React.createElement("span", { className: 'cardC__info cardC__info--corp' }, item.category), React.createElement("span", { className: 'cardC__info' }, "by ", item.versioningInfo && item.versioningInfo.modifiedBy || 'Someone', " on ", item.versioningInfo && item.date || 'Linux epoch')))))); }; return WhatsNewCard; }(react_1.Component)); exports.WhatsNewCard = WhatsNewCard;