mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Add page actions layout visibility (#4270)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Add support for hiding page actions from page layout options.
|
||||
@@ -27,13 +27,18 @@ export async function PageHeader(props: {
|
||||
|
||||
const hasAncestors = ancestors.length > 0;
|
||||
|
||||
// @ts-expect-error available in next API update
|
||||
const pageActionsEnabled = page.layout.actions !== false;
|
||||
|
||||
// Show page actions if *any* of the actions are enabled
|
||||
const hasPageActions = [
|
||||
...Object.values(context.customization.pageActions),
|
||||
context.customization.pdf.enabled,
|
||||
context.customization.git.showEditLink,
|
||||
withRSSFeed,
|
||||
].some(Boolean);
|
||||
const hasPageActions =
|
||||
pageActionsEnabled &&
|
||||
[
|
||||
...Object.values(context.customization.pageActions),
|
||||
context.customization.pdf.enabled,
|
||||
context.customization.git.showEditLink,
|
||||
withRSSFeed,
|
||||
].some(Boolean);
|
||||
|
||||
if (!page.layout.title && !page.layout.description && !hasPageActions) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user