diff --git a/src/components/DocumentView/Table/RecordCard.tsx b/src/components/DocumentView/Table/RecordCard.tsx index c69b57cd5..33740495a 100644 --- a/src/components/DocumentView/Table/RecordCard.tsx +++ b/src/components/DocumentView/Table/RecordCard.tsx @@ -78,11 +78,15 @@ export async function RecordCard( 'place-self-start', 'p-4', 'text-sm', - 'text-dark/8', - 'transition-colors', - 'group-hover:text-dark/10', - 'dark:text-light/8', - 'dark:group-hover:text-light/10', + target + ? [ + 'transition-colors', + 'text-dark/8', + 'dark:text-light/8', + 'group-hover:text-dark/10', + 'dark:group-hover:text-light/10', + ] + : ['text-dark/10', 'dark:text-light/10'], )} > {view.columns.map((column) => { @@ -99,9 +103,7 @@ export async function RecordCard( 'shadow-dark/[0.02]', 'rounded-md', 'straight-corners:rounded-none', - 'hover:before:ring-dark/4', 'dark:shadow-transparent', - 'dark:hover:before:ring-light/4', 'z-0', 'before:pointer-events-none', 'before:grid-area-1-1', @@ -118,17 +120,17 @@ export async function RecordCard( if (target) { return ( - + {body} ); } - return ( -
- {body} -
- ); + return
{body}
; } diff --git a/src/components/DocumentView/Table/RecordColumnValue.tsx b/src/components/DocumentView/Table/RecordColumnValue.tsx index 15cc54e96..9d18f8048 100644 --- a/src/components/DocumentView/Table/RecordColumnValue.tsx +++ b/src/components/DocumentView/Table/RecordColumnValue.tsx @@ -2,7 +2,7 @@ import IconStar from '@geist-ui/icons/star'; import { ContentRef, DocumentBlockTable } from '@gitbook/api'; import assertNever from 'assert-never'; -import { Checkbox, Link } from '@/components/primitives'; +import { Checkbox, Emoji, Link } from '@/components/primitives'; import { getNodeFragmentByName } from '@/lib/document'; import { tcls } from '@/lib/tailwind'; import { filterOutNullable } from '@/lib/typescript'; @@ -135,6 +135,9 @@ export async function RecordColumnValue( const resolved = value ? await context.resolveContentRef(value as ContentRef) : null; return ( + {resolved && resolved.emoji ? ( + + ) : null} {resolved ? {resolved.text} : null} ); diff --git a/src/lib/references.ts b/src/lib/references.ts index 2e6fb7ade..7f299cd90 100644 --- a/src/lib/references.ts +++ b/src/lib/references.ts @@ -8,6 +8,8 @@ import { resolvePageId } from './pages'; export interface ResolvedContentRef { /** Text to render in the content ref */ text: string; + /** Emoji associated with the reference */ + emoji?: string; /** URL to open for the content ref */ href: string; /** True if the content ref is active */ @@ -65,13 +67,16 @@ export async function resolveContentRef( return { href: pageHref(pages, page, linksContext), text: page.title, + emoji: page.emoji, active: page.id === activePage?.id, }; } + const isCurrentPage = page.id === activePage?.id; return { href: pageHref(pages, page, linksContext, contentRef.anchor), - text: page.title + '#' + contentRef.anchor, + text: (isCurrentPage ? '' : page.title) + '#' + contentRef.anchor, + emoji: isCurrentPage ? undefined : page.emoji, active: false, }; } else if (contentRef.kind === 'space' && contentRef.space === space.id) {