UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

32 lines 2.01 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 = /** @class */ (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, disabled && ('is-disabled ' + styles.isDisabled), !disabled && styles.isEnabled), onClick: this._onClick, ref: this._resolveRef('_link'), target: this.props.target, "aria-disabled": disabled }), children)) : (React.createElement("button", tslib_1.__assign({}, Utilities_1.getNativeProps(this.props, Utilities_1.buttonProperties), { className: Utilities_1.css('ms-Link', styles.root, className, disabled && ('is-disabled ' + styles.isDisabled), !disabled && styles.isEnabled), onClick: this._onClick, ref: this._resolveRef('_link'), "aria-disabled": disabled }), children))); }; Link.prototype.focus = function () { if (this._link) { this._link.focus(); } }; Link.prototype._onClick = function (ev) { var onClick = this.props.onClick; if (onClick) { onClick(ev); } }; tslib_1.__decorate([ Utilities_1.autobind ], Link.prototype, "_onClick", null); return Link; }(Utilities_1.BaseComponent)); exports.Link = Link; }); //# sourceMappingURL=Link.js.map