@skbkontur/db-viewer-ui
Version:
Database Viewer with custom configuration
38 lines • 3.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommonLayout = CommonLayout;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const IconArrowALeftRegular24_1 = require("@skbkontur/icons/IconArrowALeftRegular24");
const react_ui_1 = require("@skbkontur/react-ui");
const renderEnvironment_1 = require("@skbkontur/react-ui/lib/renderEnvironment");
const react_1 = 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 jsStyles = (0, renderEnvironment_1.useStyles)(CommonLayout_styles_1.getStyles);
const theme = (0, react_1.useContext)(react_ui_1.ThemeContext);
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `${jsStyles.commonLayout(theme)} ${withArrow ? jsStyles.withArrow() : ""}` }, restProps, { children: [topRightTools && (0, jsx_runtime_1.jsx)("div", { className: jsStyles.topRightTools(), children: topRightTools }), children] })));
}
CommonLayout.Content = function Content(_a) {
var { children } = _a, restProps = tslib_1.__rest(_a, ["children"]);
const jsStyles = (0, renderEnvironment_1.useStyles)(CommonLayout_styles_1.getStyles);
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: jsStyles.content() }, restProps, { children: children })));
};
CommonLayout.Header = function Header({ title, tools, children, borderBottom }) {
const jsStyles = (0, renderEnvironment_1.useStyles)(CommonLayout_styles_1.getStyles);
const theme = (0, react_1.useContext)(react_ui_1.ThemeContext);
return ((0, jsx_runtime_1.jsxs)("div", { className: `${jsStyles.headerWrapper()} ${borderBottom ? jsStyles.borderBottom(theme) : ""}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: jsStyles.header(), children: [(0, jsx_runtime_1.jsx)("h2", { className: jsStyles.headerTitle(), "data-tid": "Header", children: title }), tools] }), children && (0, jsx_runtime_1.jsx)("div", { className: `${jsStyles.content()} ${jsStyles.headerContent()}`, children: children })] }));
};
CommonLayout.GoBack = function CommonLayoutGoBack({ to }) {
const jsStyles = (0, renderEnvironment_1.useStyles)(CommonLayout_styles_1.getStyles);
const theme = (0, react_1.useContext)(react_ui_1.ThemeContext);
return ((0, jsx_runtime_1.jsx)(RouterLink_1.RouterLink, { "data-tid": "GoBack", to: to, className: jsStyles.backLink(), children: (0, jsx_runtime_1.jsx)(IconArrowALeftRegular24_1.IconArrowALeftRegular24, { align: "none", className: jsStyles.backLinkIcon(theme) }) }));
};
CommonLayout.ContentLoader = function ContentLoader(props) {
const jsStyles = (0, renderEnvironment_1.useStyles)(CommonLayout_styles_1.getStyles);
const { active, children } = props, restProps = tslib_1.__rest(props, ["active", "children"]);
return ((0, jsx_runtime_1.jsx)(react_ui_1.Loader, Object.assign({ className: jsStyles.loader(), active: active, size: "large" }, restProps, { children: children })));
};
//# sourceMappingURL=CommonLayout.js.map