Skip to content

Commit

Permalink
Fix table node on small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Aug 8, 2023
1 parent db65e28 commit 3e2d005
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions markdoc/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ const nodes = {
document: {
render: undefined,
},
table: {
...defaultNodes.table,
render: (props) => {
const Table = defaultNodes.table.render
return (
<div className="my-6 overflow-x-auto">
<Table {...props} />
</div>
)
},
},
th: {
...defaultNodes.th,
attributes: {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Prose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export function Prose({ as: Component = 'div', className, ...props }) {
// pre
'prose-pre:rounded-xl prose-pre:bg-slate-900 prose-pre:shadow-lg dark:prose-pre:bg-slate-800/60 dark:prose-pre:shadow-none dark:prose-pre:ring-1 dark:prose-pre:ring-slate-300/10',
// hr
'dark:prose-hr:border-slate-800'
'dark:prose-hr:border-slate-800',
// table
'prose-table:m-0'
)}
{...props}
/>
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const defaultTheme = require('tailwindcss/defaultTheme')

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,jsx,md}'],
content: ['./src/**/*.{js,jsx,md}', './markdoc/**'],
darkMode: 'class',
theme: {
fontSize: {
Expand Down

0 comments on commit 3e2d005

Please sign in to comment.