Skip to content

Commit 38de9eb

Browse files
Restore borders on embed blocks with Captions (#2755)
1 parent eac1314 commit 38de9eb

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function Caption(
2323
fit?: boolean;
2424
wrapperStyle?: ClassValue;
2525
block: DocumentBlockImage | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockFile;
26+
withBorder?: boolean;
2627
} & DocumentContextProps,
2728
) {
2829
const {
@@ -31,15 +32,17 @@ export function Caption(
3132
block,
3233
context,
3334
fit = false,
35+
withBorder = false,
3436
wrapperStyle = [
3537
'relative',
3638
'overflow-hidden',
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+
withBorder
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/Embed.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function Embed(props: BlockProps<gitbookAPI.DocumentBlockEmbed>) {
2222
: getEmbedByUrl(block.data.url));
2323

2424
return (
25-
<Caption {...props}>
25+
<Caption {...props} withBorder>
2626
{embed.type === 'rich' ? (
2727
<>
2828
<div

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} withBorder>
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)