office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
52 lines • 2.67 kB
JavaScript
define(["require", "exports", "tslib", "react", "office-ui-fabric-react/lib/Slider", "../Stack", "office-ui-fabric-react/lib/Styling"], function (require, exports, tslib_1, React, Slider_1, Stack_1, Styling_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Non-mutating styles definition
var itemStyles = {
alignItems: 'center',
background: Styling_1.DefaultPalette.themePrimary,
color: Styling_1.DefaultPalette.white,
height: 50,
display: 'flex',
justifyContent: 'center',
width: 50
};
// Tokens definition
var sectionStackTokens = { childrenGap: 10 };
var wrapStackTokens = { childrenGap: 20 };
var VerticalStackWrapExample = /** @class */ (function (_super) {
tslib_1.__extends(VerticalStackWrapExample, _super);
function VerticalStackWrapExample(props) {
var _this = _super.call(this, props) || this;
_this._onHeightChange = function (value) {
_this.setState({ stackHeight: value });
};
_this.state = {
stackHeight: 420
};
return _this;
}
VerticalStackWrapExample.prototype.render = function () {
var stackHeight = this.state.stackHeight;
// Mutating styles definition
var stackStyles = {
root: {
background: Styling_1.DefaultPalette.themeTertiary,
height: stackHeight
}
};
return (React.createElement(Stack_1.Stack, { tokens: sectionStackTokens },
React.createElement(Slider_1.Slider, { label: "Change the stack height to see how child items wrap onto multiple columns:", min: 1, max: 420, step: 1, defaultValue: 420, showValue: true, onChange: this._onHeightChange }),
React.createElement(Stack_1.Stack, { wrap: true, styles: stackStyles, tokens: wrapStackTokens },
React.createElement("span", { style: itemStyles }, "1"),
React.createElement("span", { style: itemStyles }, "2"),
React.createElement("span", { style: itemStyles }, "3"),
React.createElement("span", { style: itemStyles }, "4"),
React.createElement("span", { style: itemStyles }, "5"),
React.createElement("span", { style: itemStyles }, "6"))));
};
return VerticalStackWrapExample;
}(React.Component));
exports.VerticalStackWrapExample = VerticalStackWrapExample;
});
//# sourceMappingURL=Stack.Vertical.Wrap.Example.js.map