Skip to content

Commit c31e564

Browse files
authored
RND-8495: page group emoji and icon resolution (#3766)
1 parent 0c01832 commit c31e564

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.changeset/ready-parrots-travel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": patch
3+
---
4+
5+
Fix icon resolution for page group

packages/gitbook/src/lib/references.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,15 @@ export async function resolveContentRef(
177177
}
178178
} else {
179179
const parentPage = (resolvePageResult?.ancestors || []).slice(-1).pop();
180-
// When the looked up ref was a page group we use the page group title as resolved ref text.
181-
// Otherwise use the resolved page title.
182-
text =
180+
// When the looked up ref was a page group we use the page group to resolve title and icon.
181+
// Otherwise use the resolved page title and icon.
182+
const pageOrGroup =
183183
parentPage && contentRef.page === parentPage.id && parentPage.type === 'group'
184-
? parentPage.title
185-
: page.title;
184+
? parentPage
185+
: page;
186+
text = pageOrGroup.title;
186187
emoji = isCurrentPage ? undefined : page.emoji;
187-
icon = <PageIcon page={page} style={iconStyle} />;
188+
icon = <PageIcon page={pageOrGroup} style={iconStyle} />;
188189
}
189190

190191
return {

0 commit comments

Comments
 (0)