Commit 9c10943
authored
fix(content): stop wide markdown tables breaking the mobile layout (#5984)
* fix(content): stop wide markdown tables breaking the mobile layout
Library and blog posts render GFM tables straight into the prose container
with no width bound. Comparison tables run up to nine columns, so on a
phone the table set the article's content width and body copy was clipped
at both edges with no way to scroll to it — the table simply ran off the
canvas. 19 of 20 library posts contain a table.
Wraps tables in an `overflow-x-auto` container so that scrolling is
confined to the table's own axis, and gives the table a `min-w` so columns
do not crush to one word per line inside it. Both surfaces share
`mdxComponents`, so this covers blog posts too.
Also adds `lib/**` to Tailwind's content globs. `lib/content/mdx.tsx`
emits classes like any component, but only `app`, `components`, and `pages`
were scanned, so a class unique to that file was silently never generated
— `min-w-[520px]` here, and already `list-outside`, `text-[19px]`, and
`text-[0.9em]` on the existing paragraph and list styles. Verified against
a real browser: without the glob the rule is absent and computed
`min-width` stays `0px`. Generated CSS grows 538 bytes minified (+0.26%),
all additions, nothing removed.
* chore(content): type the table renderer instead of any
Uses `ComponentPropsWithoutRef<'table'>` so the destructured and forwarded
props are checked. The surrounding renderers in this file still take `any`;
converting them is a separate cleanup, not something to fold into a mobile
layout fix.1 parent 66ac015 commit 9c10943
2 files changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
125 | 141 | | |
126 | 142 | | |
127 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
| |||
0 commit comments