mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-06 13:23:28 +00:00
Prepare DocumentMarkColor to work with optional properties (#4659)
This commit is contained in:
@@ -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,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]'],
|
||||
|
||||
Reference in New Issue
Block a user