burdy
Version:
Open Source Headless Platform
83 lines (82 loc) • 3.87 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("@fluentui/react");
const react_2 = __importStar(require("react"));
const classnames_1 = __importDefault(require("classnames"));
const useStyles = (0, react_1.makeStyles)((theme) => ({
backButton: {
marginRight: 'auto',
color: theme.palette.neutralSecondary,
'&:hover': {
color: theme.palette.neutralPrimary,
},
},
closeButton: {
marginRight: 0,
marginLeft: 'auto',
color: theme.palette.neutralSecondary,
'&:hover': {
color: theme.palette.neutralPrimary,
},
},
backButtonIcon: {
fontSize: 20,
},
navigationContainerWrapper: {
width: '100%',
},
navigationContainer: {
display: 'flex',
padding: '12px 16px',
width: '100%',
},
title: {
display: 'block',
marginTop: 12,
marginBottom: 18,
},
}));
const BackPanel = (_a) => {
var { onDismiss, onBack, title, children } = _a, props = __rest(_a, ["onDismiss", "onBack", "title", "children"]);
const styles = useStyles();
const onRenderNavigationContent = (0, react_2.useCallback)(() => (react_2.default.createElement("div", { className: styles.navigationContainer },
onBack && (react_2.default.createElement(react_1.IconButton, { className: (0, classnames_1.default)('ms-Panel-closeButton ms-PanelAction-close', styles.backButton), onClick: () => onBack === null || onBack === void 0 ? void 0 : onBack(), iconProps: { iconName: 'Back', className: styles.backButtonIcon } })),
onDismiss && (react_2.default.createElement(react_1.IconButton, { className: (0, classnames_1.default)('ms-Panel-closeButton ms-PanelAction-close', styles.closeButton), onClick: () => onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(), iconProps: { iconName: 'Cancel', className: styles.backButtonIcon } })))), [onDismiss, onBack, title]);
return (react_2.default.createElement(react_1.Panel, Object.assign({ onRenderNavigationContent: onRenderNavigationContent, styles: { overlay: { background: 'transparent' } }, title: title }, props),
title && (react_2.default.createElement(react_1.Text, { variant: "large", className: styles.title }, title)),
children));
};
exports.default = BackPanel;