@redocly/theme
Version:
Shared UI components lib
56 lines • 3.45 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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 () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.NextButton = NextButton;
const React = __importStar(require("react"));
const NavigationButton_1 = require("../../components/PageNavigation/NavigationButton");
const hooks_1 = require("../../core/hooks");
const ArrowRightIcon_1 = require("../../icons/ArrowRightIcon/ArrowRightIcon");
function NextButton({ nextPage, className }) {
var _a, _b, _c, _d, _e, _f;
const { navigation } = (0, hooks_1.useThemeConfig)();
const { useTranslate, usePageProps } = (0, hooks_1.useThemeHooks)();
const { frontmatter } = usePageProps();
const { translate } = useTranslate();
const translationKey = 'page.nextButton';
const label = ((_b = (_a = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.navigation) === null || _a === void 0 ? void 0 : _a.nextButton) === null || _b === void 0 ? void 0 : _b.label) || (nextPage === null || nextPage === void 0 ? void 0 : nextPage.label) || (nextPage === null || nextPage === void 0 ? void 0 : nextPage.routeSlug) || '';
const link = ((_d = (_c = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.navigation) === null || _c === void 0 ? void 0 : _c.nextButton) === null || _d === void 0 ? void 0 : _d.link) || (nextPage === null || nextPage === void 0 ? void 0 : nextPage.link);
const text = ((_e = navigation === null || navigation === void 0 ? void 0 : navigation.nextButton) === null || _e === void 0 ? void 0 : _e.text) || translate(translationKey, { defaultValue: 'Next page' });
if (((_f = navigation === null || navigation === void 0 ? void 0 : navigation.nextButton) === null || _f === void 0 ? void 0 : _f.hide) || !link || !label) {
return React.createElement("div", null, "\u00A0");
}
return (React.createElement(NavigationButton_1.NavigationButton, { label: label, link: link, text: text, translationKey: translationKey, position: "right", className: className, icon: React.createElement(ArrowRightIcon_1.ArrowRightIcon, null) }));
}
//# sourceMappingURL=NextButton.js.map