Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore borders on embed blocks with Captions #2755

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/gitbook/src/components/DocumentView/Caption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export function Caption(
block: DocumentBlockImage | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockFile;
} & DocumentContextProps,
) {
const needsBorder = props.block.type === 'embed' || props.block.type === 'file';
viktorrenkema marked this conversation as resolved.
Show resolved Hide resolved

const {
children,
document,
Expand All @@ -37,9 +39,10 @@ export function Caption(
'after:block',
'after:absolute',
'after:-inset-[0]',
'dark:after:mix-blend-plus-lighter',
'after:pointer-events-none',
fit ? 'w-fit' : null,
needsBorder
? '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,
],
style,
} = props;
Expand Down
6 changes: 1 addition & 5 deletions 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} wrapperStyle={[]}>
<Caption {...props}>
<Link
href={file.downloadURL}
download={file.name}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SamyPesse I removed the styles and empty wrapperStyle that was passed to Caption in the Files block. As also mentioned in the PR description: "improves consistency by having the Files block adhere to the same bordering styles from Caption, it was using its own but these were a bit different"

Let me know if you added explicitly different bordering styles on the Files block on purpose, but if not, I think its nice to streamline these styles while i'm at it.

Expand All @@ -34,13 +34,9 @@ export async function File(props: BlockProps<DocumentBlockFile>) {
'flex',
'flex-row',
'items-center',
'border',
'px-5',
'py-3',
'border-dark/3',
'rounded-lg',
'hover:text-primary-600',
'dark:border-light/3',
'dark:hover:text-primary-300',
)}
>
Expand Down
Loading