Skip to content

Commit 0fcfae3

Browse files
committed
Restore borders on embed blocks with Captions
Fixes oversight in commit 994eb, the border in Caption should be removed when the Caption wraps image blocks, but embed blocks should be bordered
1 parent eac1314 commit 0fcfae3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/gitbook/src/components/DocumentView/Caption.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export function Caption(
2525
block: DocumentBlockImage | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockFile;
2626
} & DocumentContextProps,
2727
) {
28+
const needsBorder = props.block.type === 'embed' || props.block.type === 'file';
29+
2830
const {
2931
children,
3032
document,
@@ -37,9 +39,10 @@ export function Caption(
3739
'after:block',
3840
'after:absolute',
3941
'after:-inset-[0]',
40-
'dark:after:mix-blend-plus-lighter',
41-
'after:pointer-events-none',
4242
fit ? 'w-fit' : null,
43+
needsBorder
44+
? 'rounded straight-corners:rounded-none after:border-dark/2 after:border after:rounded straight-corners:after:rounded-none dark:after:border-light/1 dark:after:mix-blend-plus-lighter after:pointer-events-none'
45+
: null,
4346
],
4447
style,
4548
} = props;

packages/gitbook/src/components/DocumentView/File.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function File(props: BlockProps<DocumentBlockFile>) {
2121
const contentType = getSimplifiedContentType(file.contentType);
2222

2323
return (
24-
<Caption {...props} wrapperStyle={[]}>
24+
<Caption {...props}>
2525
<Link
2626
href={file.downloadURL}
2727
download={file.name}
@@ -34,13 +34,9 @@ export async function File(props: BlockProps<DocumentBlockFile>) {
3434
'flex',
3535
'flex-row',
3636
'items-center',
37-
'border',
3837
'px-5',
3938
'py-3',
40-
'border-dark/3',
41-
'rounded-lg',
4239
'hover:text-primary-600',
43-
'dark:border-light/3',
4440
'dark:hover:text-primary-300',
4541
)}
4642
>

0 commit comments

Comments
 (0)