UNPKG

@skbkontur/db-viewer-ui

Version:

Database Viewer with custom configuration

33 lines 3.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CommonLayout = void 0; const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const ArrowALeftIcon24Regular_1 = require("@skbkontur/icons/ArrowALeftIcon24Regular"); const react_ui_1 = require("@skbkontur/react-ui"); const react_1 = tslib_1.__importDefault(require("react")); const RouterLink_1 = require("../RouterLink/RouterLink"); const CommonLayout_styles_1 = require("./CommonLayout.styles"); function CommonLayout(_a) { var { children, topRightTools, withArrow } = _a, restProps = tslib_1.__rest(_a, ["children", "topRightTools", "withArrow"]); const theme = react_1.default.useContext(react_ui_1.ThemeContext); return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `${CommonLayout_styles_1.jsStyles.commonLayout(theme)} ${withArrow ? CommonLayout_styles_1.jsStyles.withArrow() : ""}` }, restProps, { children: [topRightTools && (0, jsx_runtime_1.jsx)("div", { className: CommonLayout_styles_1.jsStyles.topRightTools(), children: topRightTools }), children] }))); } exports.CommonLayout = CommonLayout; CommonLayout.Content = function Content(_a) { var { children } = _a, restProps = tslib_1.__rest(_a, ["children"]); return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: CommonLayout_styles_1.jsStyles.content() }, restProps, { children: children }))); }; CommonLayout.Header = function Header({ title, tools, children, borderBottom, }) { const theme = react_1.default.useContext(react_ui_1.ThemeContext); return ((0, jsx_runtime_1.jsxs)("div", { className: `${CommonLayout_styles_1.jsStyles.headerWrapper()} ${borderBottom ? CommonLayout_styles_1.jsStyles.borderBottom(theme) : ""}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: CommonLayout_styles_1.jsStyles.header(), children: [(0, jsx_runtime_1.jsx)("h2", { className: CommonLayout_styles_1.jsStyles.headerTitle(), "data-tid": "Header", children: title }), tools] }), children && (0, jsx_runtime_1.jsx)("div", { className: `${CommonLayout_styles_1.jsStyles.content()} ${CommonLayout_styles_1.jsStyles.headerContent()}`, children: children })] })); }; CommonLayout.GoBack = function CommonLayoutGoBack({ to }) { const theme = react_1.default.useContext(react_ui_1.ThemeContext); return ((0, jsx_runtime_1.jsx)(RouterLink_1.RouterLink, { "data-tid": "GoBack", to: to, className: CommonLayout_styles_1.jsStyles.backLink(), children: (0, jsx_runtime_1.jsx)(ArrowALeftIcon24Regular_1.ArrowALeftIcon24Regular, { align: "none", className: CommonLayout_styles_1.jsStyles.backLinkIcon(theme) }) })); }; CommonLayout.ContentLoader = function ContentLoader(props) { const { active, children } = props, restProps = tslib_1.__rest(props, ["active", "children"]); return ((0, jsx_runtime_1.jsx)(react_ui_1.Loader, Object.assign({ className: CommonLayout_styles_1.jsStyles.loader(), active: active, type: "big" }, restProps, { children: children }))); }; //# sourceMappingURL=CommonLayout.js.map