Skip to content

Commit

Permalink
fix(post): make table scrollable on small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 authored Jun 14, 2024
1 parent 23e91c9 commit 84eb36b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/blog/post/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ const mdxComponents = {
{children}
</blockquote>
),
Spoiler
Spoiler,
table: ({ children, ...rest }: ComponentProps<'table'>) => (
<div className="my-3 overflow-x-auto">
<table {...rest}>{children}</table>
</div>
)
}

const exampleToc = posts[0].toc[0]
Expand Down
2 changes: 1 addition & 1 deletion src/styles/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

table {
@apply my-4 max-w-full border-separate border-spacing-0 overflow-hidden rounded-lg;
@apply my-1 w-max border-separate border-spacing-0 overflow-hidden rounded-lg md:max-w-full;
/*@apply bg-neutral-100 dark:bg-neutral-950;*/

th,
Expand Down

0 comments on commit 84eb36b

Please sign in to comment.