Show page emoji if any (#108)

* Show page emoji if any

* Format
This commit is contained in:
Samy Pessé
2024-01-20 23:41:28 +01:00
committed by GitHub
parent 05f206a7a5
commit 0e4ba13065
7 changed files with 35 additions and 7 deletions
@@ -1,5 +1,6 @@
import { RevisionPage, RevisionPageDocument, RevisionPageGroup } from '@gitbook/api';
import { Emoji } from '@/components/primitives';
import { pageHref } from '@/lib/links';
import { getPagePath } from '@/lib/pages';
import { ContentRefContext } from '@/lib/references';
@@ -39,7 +40,14 @@ export function PageDocumentItem(props: {
) : null
}
>
{page.title}
{page.emoji ? (
<span className={tcls('flex', 'gap-3', 'flex-row')}>
<Emoji code={page.emoji} />
{page.title}
</span>
) : (
page.title
)}
</ToggleableLinkItem>
</li>
);
@@ -1,5 +1,6 @@
import { RevisionPage, RevisionPageDocument, RevisionPageGroup } from '@gitbook/api';
import { Emoji } from '@/components/primitives';
import { ContentRefContext } from '@/lib/references';
import { tcls } from '@/lib/tailwind';
@@ -36,6 +37,7 @@ export function PageGroupItem(props: {
'dark:to-transparent',
)}
>
{page.emoji ? <Emoji code={page.emoji} style={['mr-3']} /> : null}
{page.title}
</div>
{page.pages && page.pages.length ? (
@@ -2,6 +2,7 @@ import IconExternal from '@geist-ui/icons/externalLink';
import { RevisionPageLink } from '@gitbook/api';
import Link from 'next/link';
import { Emoji } from '@/components/primitives';
import { ContentRefContext, resolveContentRef } from '@/lib/references';
import { tcls } from '@/lib/tailwind';
@@ -35,6 +36,7 @@ export async function PageLinkItem(props: { page: RevisionPageLink; context: Con
'dark:hover:bg-light/2',
)}
>
{page.emoji ? <Emoji code={page.emoji} /> : null}
{page.title}
<IconExternal
className={tcls(