UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

44 lines (42 loc) 1.92 kB
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var React = require('react'); var DocumentCard_Props_1 = require('./DocumentCard.Props'); var css_1 = require('../../utilities/css'); require('./DocumentCard.scss'); var DocumentCard = (function (_super) { __extends(DocumentCard, _super); function DocumentCard() { _super.apply(this, arguments); } DocumentCard.prototype.render = function () { var _a = this.props, onClick = _a.onClick, onClickHref = _a.onClickHref, children = _a.children, className = _a.className, type = _a.type, accentColor = _a.accentColor; // If no onClickFunction was provided and we do have an onClickURL, create a function from it. if (!onClick && onClickHref) { onClick = function () { window.location.href = onClickHref; }; } // Override the border color if an accent color was provided (compact card only) var style; if (type === DocumentCard_Props_1.DocumentCardType.compact && accentColor) { style = { borderBottomColor: accentColor }; } return (React.createElement("div", {className: css_1.css('ms-DocumentCard', { 'ms-DocumentCard--actionable': onClick ? true : false, 'ms-DocumentCard--compact': type === DocumentCard_Props_1.DocumentCardType.compact ? true : false }, className), onClick: onClick, style: style}, children)); }; DocumentCard.defaultProps = { type: DocumentCard_Props_1.DocumentCardType.normal }; return DocumentCard; }(React.Component)); exports.DocumentCard = DocumentCard; //# sourceMappingURL=DocumentCard.js.map