UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

44 lines (42 loc) 2.13 kB
define(["require", "exports", "tslib", "react", "../../Utilities", "./Link.scss"], function (require, exports, tslib_1, React, Utilities_1, stylesImport) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var styles = stylesImport; var Link = (function (_super) { tslib_1.__extends(Link, _super); function Link() { return _super !== null && _super.apply(this, arguments) || this; } Link.prototype.render = function () { var _a = this.props, disabled = _a.disabled, children = _a.children, className = _a.className, href = _a.href; return (href ? (React.createElement("a", tslib_1.__assign({}, Utilities_1.getNativeProps(this.props, Utilities_1.anchorProperties), { className: Utilities_1.css('ms-Link', styles.root, className, (_b = { 'is-disabled': disabled }, _b[styles.isDisabled] = disabled, _b[styles.isEnabled] = !disabled, _b)), onClick: this._onClick, ref: this._resolveRef('_link'), target: this.props.target }), children)) : (React.createElement("button", tslib_1.__assign({}, Utilities_1.getNativeProps(this.props, Utilities_1.buttonProperties), { className: Utilities_1.css('ms-Link', styles.root, className, (_c = { 'is-disabled': disabled }, _c[styles.isDisabled] = disabled, _c)), onClick: this._onClick, ref: this._resolveRef('_link') }), children))); var _b, _c; }; Link.prototype.focus = function () { if (this._link) { this._link.focus(); } }; Link.prototype._onClick = function (ev) { var onClick = this.props.onClick; if (onClick) { onClick(ev); } }; return Link; }(Utilities_1.BaseComponent)); tslib_1.__decorate([ Utilities_1.autobind ], Link.prototype, "_onClick", null); exports.Link = Link; }); //# sourceMappingURL=Link.js.map