Skip to content

Commit ab56507

Browse files
authored
Fix mobile portrait layout overflow and overlaps (#190)
* Fix mobile portrait layout overflow and overlaps Reference names overlapped their descriptions, docs articles and cards ran wider than the screen, and the blog header took two to three sticky rows on phones. * Keep wide blog tables and long inline code inside the post on phones * Fix blog menu focus and landmarks, touch-sized selects and phone headings * Keep blog menu open until focus lands outside it, for Safari clicks
1 parent 79e5841 commit ab56507

14 files changed

Lines changed: 208 additions & 50 deletions

File tree

‎app/ai/page.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export default function AIPage() {
278278
</div>
279279

280280
<div className="min-w-0 rounded-3xl border border-white/10 bg-neutral-900/90 p-5 shadow-[0_24px_80px_-40px_rgba(139,92,246,0.45)] sm:p-6">
281-
<div className="mb-4 flex items-center justify-between gap-3">
281+
<div className="mb-4 flex flex-wrap items-center justify-between gap-x-3 gap-y-2">
282282
<span className="inline-flex rounded-full border border-violet-400/30 bg-violet-500/10 px-3 py-1 text-xs font-semibold uppercase tracking-[0.18em] text-violet-200">
283283
Quick start
284284
</span>
@@ -372,7 +372,7 @@ export default function AIPage() {
372372
{quickStartSteps.map((item) => (
373373
<article
374374
key={item.step}
375-
className="flex h-full flex-col rounded-3xl border border-neutral-800 bg-neutral-900/80 p-5 shadow-[0_24px_80px_-50px_rgba(139,92,246,0.45)] sm:p-6"
375+
className="flex h-full min-w-0 flex-col rounded-3xl border border-neutral-800 bg-neutral-900/80 p-5 shadow-[0_24px_80px_-50px_rgba(139,92,246,0.45)] sm:p-6"
376376
>
377377
<div className="mb-4 flex items-center gap-3">
378378
<span className="inline-flex h-9 w-9 items-center justify-center rounded-full border border-violet-400/30 bg-violet-500/10 text-xs font-semibold text-violet-200">

‎app/components/Breadcrumb.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ export default function Breadcrumb({ type, category, name }: {
77
category?: string;
88
name?: string;
99
}) {
10+
// The separator spans carry no spaces, so without flex-wrap a long trail never breaks
1011
return (
11-
<nav className="mb-6 text-sm text-gray-400">
12+
<nav className="mb-6 flex flex-wrap items-center gap-y-1 text-sm text-gray-400">
1213
<Link href="/docs/reference" className="hover:text-blue-400 transition-colors">
1314
Reference
1415
</Link>

‎app/components/ComingSoon.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default function ComingSoon() {
22
return (
33
<div className="relative mb-8">
44
{/* Main container with glow effect */}
5-
<div className="relative w-80 h-80 mx-auto">
5+
<div className="relative w-full max-w-80 h-80 mx-auto">
66
{/* Background glow */}
77
<div className="absolute inset-0 bg-gradient-to-r from-blue-500/20 via-purple-500/20 to-cyan-500/20 rounded-2xl blur-xl"></div>
88

‎app/components/Grid.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ export default function Grid({ items }: {
1212
key={page.reference}
1313
className="bg-neutral-900/30 rounded-lg p-4 border border-neutral-600/20 text-left hover:border-blue-500/40 hover:bg-neutral-700/30 transition-all duration-200 group"
1414
href={`/docs/reference/${page.reference}`}>
15-
<div className="grid md:grid-cols-[20%_80%] grid-cols-[10%_90%] mb-2">
16-
<h4 className="text-blue-300 font-mono font-medium group-hover:text-blue-200">
15+
{/* Stack until there is room for a fixed column wide enough for $setWindowFields */}
16+
<div className="grid gap-1 lg:grid-cols-[12rem_minmax(0,1fr)] lg:gap-0 mb-2">
17+
<h4 className="text-blue-300 font-mono font-medium group-hover:text-blue-200 break-words">
1718
{page.name}
1819
</h4>
1920
<p className="text-xs text-gray-400 italic">

‎app/components/Markdown.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function Markdown({ content, sourcePath }: MarkdownProps) {
4444
elements.push(
4545
<div key={`section-${index}`} className="bg-neutral-800/50 backdrop-blur-sm rounded-lg border border-neutral-700/50 p-6">
4646
<a className="invisible scroll-mt-24" id={headingAnchor(title)} />
47-
<h2 className="text-2xl font-semibold text-white mb-4">
47+
<h2 className="text-xl sm:text-2xl font-semibold text-white mb-4">
4848
{title}
4949
</h2>
5050
<ReactMarkdown
@@ -61,15 +61,16 @@ export default function Markdown({ content, sourcePath }: MarkdownProps) {
6161
return elements;
6262
}, [content, sourcePath]);
6363

64-
return <div className="space-y-8">{processedContent}</div>;
64+
// Long inline code, URLs and identifiers would otherwise push the article wider than a phone
65+
return <div className="space-y-8 break-words">{processedContent}</div>;
6566
}
6667

6768
function getMarkdownComponents(sourcePath: string) {
6869
return {
6970
// H1 headings (main page title from Markdown content)
7071
h1: ({ children, ...props }: any) => (
7172
<>
72-
<h1 className="text-4xl font-bold text-white mb-4" {...props}>
73+
<h1 className="text-3xl sm:text-4xl font-bold text-white mb-4" {...props}>
7374
{children}
7475
</h1>
7576
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 rounded-full mb-6"></div>

‎app/docs/[section]/[[...slug]]/page.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export default async function ArticlePage({ params }: PageProps) {
229229

230230
{/* Coming Soon Component for coming-soon layout */}
231231
{showComingSoonHeading && (
232-
<h1 className="text-4xl font-bold text-white mb-4">
232+
<h1 className="text-3xl sm:text-4xl font-bold text-white mb-4">
233233
{pageTitle}
234234
</h1>
235235
)}
@@ -262,8 +262,9 @@ export default async function ArticlePage({ params }: PageProps) {
262262
</p>
263263
</div>
264264
</div>
265+
{/* min-w-0 stops the command's longest line from sizing the column */}
265266
<div className="grid gap-4 lg:grid-cols-2">
266-
<div className="rounded-xl border border-neutral-800 bg-neutral-900/70 p-4">
267+
<div className="min-w-0 rounded-xl border border-neutral-800 bg-neutral-900/70 p-4">
267268
<p className="text-sm font-semibold text-white">
268269
Run locally with Docker
269270
</p>
@@ -282,7 +283,7 @@ export default async function ArticlePage({ params }: PageProps) {
282283
</Link>
283284
</div>
284285
</div>
285-
<div className="rounded-xl border border-neutral-800 bg-neutral-900/70 p-4">
286+
<div className="min-w-0 rounded-xl border border-neutral-800 bg-neutral-900/70 p-4">
286287
<p className="text-sm font-semibold text-white">
287288
Install from Linux packages
288289
</p>

‎app/docs/reference/[type]/[category]/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default async function CommandReferencePage({ params }: { params: Promise
3939
<article>
4040
<Breadcrumb type={type} category={category} />
4141
<div className="mb-8">
42-
<h1 className="text-4xl font-bold text-white mb-4 capitalize">
42+
<h1 className="text-3xl sm:text-4xl font-bold text-white mb-4 capitalize">
4343
MongoDB Query Language (MQL) {capitalCase(category)} {capitalCase(pluralize(type))}
4444
</h1>
4545
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 rounded-full mb-6"></div>

‎app/docs/reference/[type]/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default async function CommandReferencePage({ params }: { params: Promise
3838
<article>
3939
<Breadcrumb type={type} />
4040
<div className="mb-8">
41-
<h1 className="text-4xl font-bold text-white mb-4 capitalize">
41+
<h1 className="text-3xl sm:text-4xl font-bold text-white mb-4 capitalize">
4242
MongoDB Query Language (MQL) {capitalCase(pluralize(type))}
4343
</h1>
4444
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 rounded-full mb-6"></div>

‎app/docs/reference/layout.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ export default function ReferenceLayout({
1717
}>) {
1818
const groupedReferences = getReferencesGroupedByTypeAndCategory();
1919

20+
// Phones get no sidebar, so the page scrolls rather than a 100vh pane half under the navbar
2021
return (
21-
<div className="min-h-screen bg-neutral-900 relative overflow-hidden max-h-screen">
22+
<div className="min-h-screen bg-neutral-900 relative overflow-hidden md:max-h-screen">
2223
{/* Background elements */}
2324
<div className="absolute inset-0 bg-gradient-to-br from-neutral-900 via-neutral-800 to-black"></div>
2425
<div className="absolute inset-0 opacity-5">
@@ -28,7 +29,7 @@ export default function ReferenceLayout({
2829
style={{ animationDelay: "1.5s" }}
2930
></div>
3031
</div>
31-
<div className="relative flex h-screen">
32+
<div className="relative flex md:h-screen">
3233
{/* Sidebar (desktop only; mobile gets the disclosure below) */}
3334
<div className="hidden w-80 bg-neutral-800/50 backdrop-blur-sm border-r border-neutral-700/50 md:flex flex-col h-full">
3435
<div className="p-6 border-b border-neutral-700/50 flex-shrink-0">
@@ -52,7 +53,7 @@ export default function ReferenceLayout({
5253
</div>
5354
<Index groupedReferences={groupedReferences} />
5455
</div>
55-
<article className="flex-1 p-4 sm:p-8 overflow-y-auto h-full">
56+
<article className="min-w-0 flex-1 p-4 sm:p-8 md:h-full md:overflow-y-auto">
5657
<div className="max-w-4xl">
5758
{/* Mobile reference navigation */}
5859
<details className="mb-6 rounded-lg border border-neutral-700/50 bg-neutral-800/50 md:hidden">

‎app/docs/reference/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function Home() {
2424
<article>
2525
<Breadcrumb />
2626
<div className="mb-8">
27-
<h1 className="text-4xl font-bold text-white mb-4">
27+
<h1 className="text-3xl sm:text-4xl font-bold text-white mb-4">
2828
MongoDB Query Language (MQL)
2929
</h1>
3030
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 rounded-full mb-6"></div>

0 commit comments

Comments
 (0)