UNPKG

3.42 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.PageSection = exports.PageSectionTypes = exports.PageSectionVariants = void 0;
4const tslib_1 = require("tslib");
5const React = tslib_1.__importStar(require("react"));
6const page_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Page/page"));
7const react_styles_1 = require("@patternfly/react-styles");
8const util_1 = require("../../helpers/util");
9var PageSectionVariants;
10(function (PageSectionVariants) {
11 PageSectionVariants["default"] = "default";
12 PageSectionVariants["light"] = "light";
13 PageSectionVariants["dark"] = "dark";
14 PageSectionVariants["darker"] = "darker";
15})(PageSectionVariants = exports.PageSectionVariants || (exports.PageSectionVariants = {}));
16var PageSectionTypes;
17(function (PageSectionTypes) {
18 PageSectionTypes["default"] = "default";
19 PageSectionTypes["nav"] = "nav";
20 PageSectionTypes["subNav"] = "subnav";
21 PageSectionTypes["breadcrumb"] = "breadcrumb";
22 PageSectionTypes["tabs"] = "tabs";
23 PageSectionTypes["wizard"] = "wizard";
24})(PageSectionTypes = exports.PageSectionTypes || (exports.PageSectionTypes = {}));
25const variantType = {
26 [PageSectionTypes.default]: page_1.default.pageMainSection,
27 [PageSectionTypes.nav]: page_1.default.pageMainNav,
28 [PageSectionTypes.subNav]: page_1.default.pageMainSubnav,
29 [PageSectionTypes.breadcrumb]: page_1.default.pageMainBreadcrumb,
30 [PageSectionTypes.tabs]: page_1.default.pageMainTabs,
31 [PageSectionTypes.wizard]: page_1.default.pageMainWizard
32};
33const variantStyle = {
34 [PageSectionVariants.default]: '',
35 [PageSectionVariants.light]: page_1.default.modifiers.light,
36 [PageSectionVariants.dark]: page_1.default.modifiers.dark_200,
37 [PageSectionVariants.darker]: page_1.default.modifiers.dark_100
38};
39const PageSection = (_a) => {
40 var { className = '', children, variant = 'default', type = 'default', padding, isFilled, isWidthLimited = false, isCenterAligned = false, sticky, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false } = _a, props = tslib_1.__rest(_a, ["className", "children", "variant", "type", "padding", "isFilled", "isWidthLimited", "isCenterAligned", "sticky", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll"]);
41 return (React.createElement("section", Object.assign({}, props, { className: react_styles_1.css(variantType[type], util_1.formatBreakpointMods(padding, page_1.default), variantStyle[variant], isFilled === false && page_1.default.modifiers.noFill, isFilled === true && page_1.default.modifiers.fill, isWidthLimited && page_1.default.modifiers.limitWidth, isWidthLimited && isCenterAligned && type !== PageSectionTypes.subNav && page_1.default.modifiers.alignCenter, sticky === 'top' && page_1.default.modifiers.stickyTop, sticky === 'bottom' && page_1.default.modifiers.stickyBottom, hasShadowTop && page_1.default.modifiers.shadowTop, hasShadowBottom && page_1.default.modifiers.shadowBottom, hasOverflowScroll && page_1.default.modifiers.overflowScroll, className) }, (hasOverflowScroll && { tabIndex: 0 })),
42 isWidthLimited && React.createElement("div", { className: react_styles_1.css(page_1.default.pageMainBody) }, children),
43 !isWidthLimited && children));
44};
45exports.PageSection = PageSection;
46exports.PageSection.displayName = 'PageSection';
47//# sourceMappingURL=PageSection.js.map
\No newline at end of file