Skip to content

Commit

Permalink
Use a prop for opting in for border + increase sensitivity in test
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorrenkema committed Jan 17, 2025
1 parent 0fcfae3 commit cd4d835
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/gitbook/e2e/pages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ const testCases: TestsCase[] = [
name: 'Embeds',
url: 'blocks/embeds',
fullPage: true,
screenshot: { threshold: 0 },
},
{
name: 'Page links',
Expand Down
6 changes: 3 additions & 3 deletions packages/gitbook/src/components/DocumentView/Caption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ export function Caption(
fit?: boolean;
wrapperStyle?: ClassValue;
block: DocumentBlockImage | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockFile;
withBorder?: boolean;
} & DocumentContextProps,
) {
const needsBorder = props.block.type === 'embed' || props.block.type === 'file';

const {
children,
document,
block,
context,
fit = false,
withBorder = false,
wrapperStyle = [
'relative',
'overflow-hidden',
'after:block',
'after:absolute',
'after:-inset-[0]',
fit ? 'w-fit' : null,
needsBorder
withBorder
? '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'
: null,
],
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/DocumentView/Embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function Embed(props: BlockProps<gitbookAPI.DocumentBlockEmbed>) {
: getEmbedByUrl(block.data.url));

return (
<Caption {...props}>
<Caption {...props} withBorder>
{embed.type === 'rich' ? (
<>
<div
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/DocumentView/File.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function File(props: BlockProps<DocumentBlockFile>) {
const contentType = getSimplifiedContentType(file.contentType);

return (
<Caption {...props}>
<Caption {...props} withBorder>
<Link
href={file.downloadURL}
download={file.name}
Expand Down

0 comments on commit cd4d835

Please sign in to comment.