UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

88 lines 5.51 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { Breadcrumb } from 'office-ui-fabric-react/lib/Breadcrumb'; import { Label } from 'office-ui-fabric-react/lib/Label'; import * as exampleStylesImport from '../../../common/_exampleStyles.scss'; import { TooltipHost } from 'office-ui-fabric-react/lib/Tooltip'; var exampleStyles = exampleStylesImport; var BreadcrumbBasicExample = /** @class */ (function (_super) { tslib_1.__extends(BreadcrumbBasicExample, _super); function BreadcrumbBasicExample(props) { var _this = _super.call(this, props) || this; _this._onBreadcrumbItemClicked = function (ev, item) { console.log("Breadcrumb item with key \"" + item.key + "\" has been clicked."); }; _this._getCustomDivider = function (dividerProps) { var tooltipText = dividerProps.item ? dividerProps.item.text : ''; return (React.createElement(TooltipHost, { content: "Show " + tooltipText + " contents", id: "myID", calloutProps: { gapSpace: 0 } }, React.createElement("span", { style: { cursor: 'pointer' } }, "/"))); }; return _this; } BreadcrumbBasicExample.prototype.render = function () { return (React.createElement("div", null, React.createElement(Label, { className: exampleStyles.exampleLabel }, "With no maxDisplayedItems"), React.createElement(Breadcrumb, { items: [ { text: 'Files', key: 'Files', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 1', key: 'f1', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 2', key: 'f2', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 3', key: 'f3', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 4', key: 'f4', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 5', key: 'f5', onClick: this._onBreadcrumbItemClicked, isCurrentItem: true } ], ariaLabel: 'Website breadcrumb' }), React.createElement(Label, { className: exampleStyles.exampleLabel, style: { marginTop: '24px' } }, "With Custom Divider Icon"), React.createElement(Breadcrumb, { items: [ { text: 'Files', key: 'Files', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 1', key: 'f1', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 2', key: 'f2', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 3', key: 'f3', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 4', key: 'f4', onClick: this._onBreadcrumbItemClicked }, { text: 'This is folder 5', key: 'f5', onClick: this._onBreadcrumbItemClicked, isCurrentItem: true } ], dividerAs: this._getCustomDivider, ariaLabel: 'Website breadcrumb' }), React.createElement(Label, { className: exampleStyles.exampleLabel, style: { marginTop: '24px' } }, "With maxDisplayedItems set to three"), React.createElement(Breadcrumb, { items: [ { text: 'Files', key: 'Files', href: '#/examples/breadcrumb', onClick: this._onBreadcrumbItemClicked }, { text: 'This is link 1', key: 'l1', href: '#/examples/breadcrumb', onClick: this._onBreadcrumbItemClicked }, { text: 'This is link 2', key: 'l2', href: '#/examples/breadcrumb', onClick: this._onBreadcrumbItemClicked }, { text: 'This is link 3 with a long name', key: 'l3', href: '#/examples/breadcrumb', onClick: this._onBreadcrumbItemClicked }, { text: 'This is link 4', key: 'l4', href: '#/examples/breadcrumb', onClick: this._onBreadcrumbItemClicked }, { text: 'This is link 5', key: 'l5', href: '#/examples/breadcrumb', onClick: this._onBreadcrumbItemClicked, isCurrentItem: true } ], maxDisplayedItems: 3, ariaLabel: 'Website breadcrumb' }), React.createElement(Label, { className: exampleStyles.exampleLabel, style: { marginTop: '24px' } }, "With maxDisplayedItems set to two and overflowIndex set to 1 (second element)"), React.createElement(Breadcrumb, { items: [ { text: 'TestText1', key: 'TestKey1' }, { text: 'TestText2', key: 'TestKey2' }, { text: 'TestText3', key: 'TestKey3' }, { text: 'TestText4', key: 'TestKey4' } ], maxDisplayedItems: 2, overflowIndex: 1 }))); }; return BreadcrumbBasicExample; }(React.Component)); export { BreadcrumbBasicExample }; //# sourceMappingURL=Breadcrumb.Basic.Example.js.map