Skip to content

Commit 6c398ff

Browse files
committed
web: fix the page header; the grid pane scrolls in both directions
The header stays put and the pane below it is the only scroll container, so column headers and the release column pin inside it on any viewport. Small screens get a shorter header, a narrower release column and a smaller grid minimum width.
1 parent 7fde8d5 commit 6c398ff

4 files changed

Lines changed: 24 additions & 20 deletions

File tree

‎index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='%233b82c4'/%3E%3C/svg%3E">
88
</head>
99
<body>
10-
<div id="app" class="min-w-(--grid-min-width)"></div>
10+
<div id="app" class="flex h-dvh flex-col"></div>
1111
<script type="module" src="/web/src/main.ts"></script>
1212
</body>
1313
</html>

‎web/src/App.vue‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ function label(key: string): string {
3838
</script>
3939

4040
<template>
41-
<!-- Sticky to the left so the page chrome stays put while a wide grid scrolls sideways. -->
42-
<header class="sticky left-0 max-w-screen px-6 pt-6 pb-5">
41+
<header class="shrink-0 px-4 pt-4 pb-4 md:px-6 md:pt-6 md:pb-5">
4342
<div class="flex items-start justify-between gap-4">
4443
<h1 class="text-2xl font-semibold tracking-tight">NativeScript compatibility</h1>
4544
<ThemeToggle />
4645
</div>
47-
<p class="mt-1 max-w-3xl text-neutral-600 dark:text-neutral-400">
46+
<p class="mt-1 hidden max-w-3xl text-neutral-600 md:block dark:text-neutral-400">
4847
Which toolchains each runtime and CLI release supports, from published package metadata, CI
4948
verification runs and maintainer advisories. Click a cell for the version-by-version picture.
5049
</p>
@@ -67,7 +66,7 @@ function label(key: string): string {
6766
</template>
6867
</span>
6968
</nav>
70-
<div class="mt-5 flex flex-wrap items-center justify-between gap-x-8 gap-y-3">
69+
<div class="mt-4 flex flex-wrap items-center justify-between gap-x-8 gap-y-3 md:mt-5">
7170
<div class="flex flex-wrap items-center gap-5">
7271
<input
7372
v-model="query"
@@ -87,13 +86,15 @@ function label(key: string): string {
8786
</div>
8887
</header>
8988

90-
<main>
91-
<p v-if="error" class="sticky left-0 max-w-screen px-6 text-bad">Could not load compatibility data: {{ error }}</p>
92-
<p v-else-if="!document" class="sticky left-0 max-w-screen px-6 text-neutral-500 dark:text-neutral-400">Loading…</p>
93-
<template v-else>
89+
<!-- The pane below the header is the only thing that scrolls, in both directions, so the
90+
grid's sticky headers and anything pinned to its left edge resolve against it. -->
91+
<main class="@container min-h-0 flex-1 overflow-auto">
92+
<p v-if="error" class="px-6 text-bad">Could not load compatibility data: {{ error }}</p>
93+
<p v-else-if="!document" class="px-6 text-neutral-500 dark:text-neutral-400">Loading…</p>
94+
<div v-else class="min-w-(--grid-min-width)">
9495
<CompatGrid v-model:open="open" v-model:expanded="expanded" :document="document" :query="query" :show-prereleases="showPrereleases" />
9596

96-
<section v-if="document.advisories.length" class="sticky left-0 max-w-screen px-6 pt-10">
97+
<section v-if="document.advisories.length" class="sticky left-0 max-w-[100cqw] px-6 pt-10">
9798
<h2 class="text-base font-semibold">Advisories</h2>
9899
<ul class="mt-3 space-y-4 text-sm">
99100
<li v-for="advisory in document.advisories" :key="advisory.id" class="flex gap-2.5">
@@ -117,6 +118,6 @@ function label(key: string): string {
117118
</li>
118119
</ul>
119120
</section>
120-
</template>
121+
</div>
121122
</main>
122123
</template>

‎web/src/components/CompatGrid.vue‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,15 @@ const headCell = `sticky z-10 bg-neutral-50 text-center font-semibold dark:bg-ne
8383
</script>
8484

8585
<template>
86-
<!-- The table overflows the document rather than a wrapper: a scrolling wrapper would
87-
become the sticky containing block and the column headers would scroll away. -->
8886
<div class="border-y border-neutral-200 dark:border-neutral-700/80">
8987
<table class="w-full min-w-(--grid-min-width) table-fixed border-separate border-spacing-0 text-sm">
9088
<colgroup>
91-
<col class="w-40 lg:w-88" />
89+
<col class="w-32 md:w-40 lg:w-88" />
9290
<col v-for="key in ALL_KEYS" :key="key" />
9391
</colgroup>
9492
<thead>
9593
<tr>
96-
<th rowspan="2" :class="headCell" class="top-0 left-0 z-20 px-6 py-3 text-left align-bottom">Release</th>
94+
<th rowspan="2" :class="headCell" class="top-0 left-0 z-20 px-4 py-3 text-left align-bottom md:px-6">Release</th>
9795
<th
9896
v-for="group in COLUMNS"
9997
:key="group.platform"
@@ -114,7 +112,7 @@ const headCell = `sticky z-10 bg-neutral-50 text-center font-semibold dark:bg-ne
114112
:colspan="ALL_KEYS.length + 1"
115113
class="border-b border-neutral-200 bg-sky-50/70 py-2 text-left font-semibold dark:border-neutral-700/80 dark:bg-sky-900/25"
116114
>
117-
<div class="sticky left-0 inline-block px-6">
115+
<div class="sticky left-0 inline-block px-4 md:px-6">
118116
<a
119117
:href="`https://www.npmjs.com/package/${group.name}`"
120118
target="_blank"
@@ -131,7 +129,7 @@ const headCell = `sticky z-10 bg-neutral-50 text-center font-semibold dark:bg-ne
131129
<th
132130
scope="row"
133131
:class="border"
134-
class="sticky left-0 z-[1] bg-white px-6 py-3 text-left align-top font-medium group-hover:bg-neutral-50 dark:bg-neutral-950 dark:group-hover:bg-neutral-800"
132+
class="sticky left-0 z-[1] bg-white px-4 py-3 text-left align-top font-medium md:px-6 group-hover:bg-neutral-50 dark:bg-neutral-950 dark:group-hover:bg-neutral-800"
135133
>
136134
<a
137135
:href="`https://www.npmjs.com/package/${group.name}/v/${version}`"
@@ -166,7 +164,7 @@ const headCell = `sticky z-10 bg-neutral-50 text-center font-semibold dark:bg-ne
166164
</tr>
167165
</template>
168166
<tr v-if="group.total > INITIAL_ROWS && !normalizedQuery">
169-
<th scope="row" :class="border" class="sticky left-0 z-[1] bg-white px-6 py-2 text-left dark:bg-neutral-950">
167+
<th scope="row" :class="border" class="sticky left-0 z-[1] bg-white px-4 py-2 text-left md:px-6 dark:bg-neutral-950">
170168
<button
171169
type="button"
172170
class="rounded-lg border border-neutral-300 bg-neutral-100 px-3 py-1.5 text-sm font-medium hover:bg-neutral-200 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:bg-neutral-700"
@@ -179,6 +177,6 @@ const headCell = `sticky z-10 bg-neutral-50 text-center font-semibold dark:bg-ne
179177
</tr>
180178
</tbody>
181179
</table>
182-
<p v-if="!groups.length" class="sticky left-0 max-w-screen px-6 py-4 text-neutral-500 dark:text-neutral-400">No releases match.</p>
180+
<p v-if="!groups.length" class="sticky left-0 max-w-[100cqw] px-6 py-4 text-neutral-500 dark:text-neutral-400">No releases match.</p>
183181
</div>
184182
</template>

‎web/src/style.css‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
html {
1616
font-feature-settings: "cv11", "ss01";
1717
color-scheme: light;
18-
/* Below this the document scrolls sideways and the page chrome pins itself to the left. */
18+
/* Below this the grid pane scrolls sideways under the fixed page header. */
1919
--grid-min-width: 66rem;
2020
}
21+
@media (width < 48rem) {
22+
html {
23+
--grid-min-width: 50rem;
24+
}
25+
}
2126
html.dark {
2227
color-scheme: dark;
2328
/* Brighter status colours: the light-mode values sink into a dark background. */

0 commit comments

Comments
 (0)