diff --git a/packages/gitbook/src/components/DocumentView/Table/RecordColumnValue.tsx b/packages/gitbook/src/components/DocumentView/Table/RecordColumnValue.tsx index 50dc0d827..710746a92 100644 --- a/packages/gitbook/src/components/DocumentView/Table/RecordColumnValue.tsx +++ b/packages/gitbook/src/components/DocumentView/Table/RecordColumnValue.tsx @@ -22,6 +22,12 @@ import { FileIcon } from '../FileIcon'; import type { TableRecordKV } from './Table'; import { type VerticalAlignment, getColumnAlignment } from './utils'; +const alignmentMap: Record<'text-left' | 'text-center' | 'text-right', string> = { + 'text-left': '[&_*]:text-left text-left', + 'text-center': '[&_*]:text-center text-center', + 'text-right': '[&_*]:text-right text-right', +}; + /** * Render the value for a column in a record. */ @@ -116,7 +122,7 @@ export async function RecordColumnValue( } const horizontalAlignment = getColumnAlignment(definition); - const childrenHorizontalAlignment = `[&_*]:${horizontalAlignment}`; + const horizontalClasses = alignmentMap[horizontalAlignment]; return ( ( 'lg:space-y-3', 'leading-normal', verticalAlignment, - horizontalAlignment, - childrenHorizontalAlignment, + horizontalClasses, ]} context={context} blockStyle={['w-full', 'max-w-[unset]']}