Prepare DocumentMarkColor to work with optional properties (#4659)

This commit is contained in:
Brett Jephson
2026-10-05 17:55:22 +01:00
committed by GitHub
parent 7996c362c1
commit b1102fcebe
3 changed files with 8 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Use the DocumentTextColor type defined in API schema.
@@ -117,8 +117,8 @@ function Color(props: MarkedLeafProps<DocumentMarkColor>) {
return (
<span
className={tcls([
textColorToStyle[mark.data.text],
backgroundColorToStyle[mark.data.background],
textColorToStyle[mark.data.text ?? 'default'],
backgroundColorToStyle[mark.data.background ?? 'default'],
])}
>
{children}
+1 -3
View File
@@ -1,9 +1,7 @@
import type { DocumentMarkColor } from '@gitbook/api';
import type { DocumentTextColor } from '@gitbook/api';
import type { ClassValue } from '@/lib/tailwind';
type DocumentTextColor = DocumentMarkColor['data']['text'] | 'pink' | 'violet' | 'cyan' | '$tint';
export const textColorToStyle = {
default: [],
blue: ['text-[#0067d1] dark:text-[#7dbcff]'],