fix(repos): use container queries instead, works nice
+ 79
- 53
@@ -1,5 +1,5 @@
 {
-  "_generatedAtUnix": 1778833431035,
+  "_generatedAtUnix": 1778835583155,
   "_hashAlgorithm": "sha1",
   "_version": 2,
   "assets": {

...
@@ -40,7 +40,7 @@
       "pathSourceMap": "./public/.islands/PullRequestSourceSelect.bundle.js.map"
     },
     "RepositoriesList": {
-      "hash": "833571661d443206bbf57309f86566d5c8b87393",
+      "hash": "fe287b3d71b1600333705fe6bf938f37181ba2f6",
       "pathSource": "./app/islands/RepositoriesList.tsx",
       "pathBundle": "./public/.islands/RepositoriesList.bundle.js",
       "pathSourceMap": "./public/.islands/RepositoriesList.bundle.js.map"

app/islands/RepositoriesList.tsx
@@ -19,15 +19,17 @@ export interface RepositoriesListProps {
 const RepositoriesList: ReactIsland<
   RepositoriesListProps & WithThemeSchemeProp
 > = ({ repositories, themeScheme }) => {
+  const selector = ".container";
   return (
-    <Grid.Row
-      fluid
-      gap={4}
-      alignItems={"stretch"}
-      justifyContent={"stretch"}
-      style={{ marginTop: 16 }}
-    >
+    <>
       <style>{`
+        .container {
+          container-type: size;
+          container-name: repositories;
+          min-block-size: 210px;
+          height: max-content;
+        }
+
         .card {
           min-width: 300px;
           width: 100%;

...
@@ -36,14 +38,14 @@ const RepositoriesList: ReactIsland<
           gap: 8px;
         }
 
-        @media only screen and (max-width: ${breakpoints.sml}) {
+        @container repositories (min-width: ${breakpoints.sml}) {
           .card {
             flex: .3;
             min-width: calc(33% - 8px);
           }
         }
 
-        @media only screen and (max-width: ${breakpoints.sm}) {
+        @container repositories (max-width: ${breakpoints.sml}) {
           .card {
             flex: .5;
             min-width: calc(50% - 8px);

...
@@ -57,48 +59,72 @@ const RepositoriesList: ReactIsland<
           }
         }
       `}</style>
-      {repositories.map((repo) => (
-        <Card key={repo.id} themeScheme={themeScheme} className="card">
-          <Grid.Row fluid nowrap>
-            <h1 style={{ margin: 0, flex: 1 }}>
-              <a
-                href={buildRouteLink(AppRoute.REPOSITORY_DETAILS, {
-                  orgSlug: repo.parentOrg.slug,
-                  repoSlug: repo.slug,
-                })}
-              >
-                {repo.parentOrg.displayName || repo.parentOrg.slug}
-                {" / "}
-                {repo.displayName || repo.slug}
-                {" ∙ "}
-                <span style={{ textTransform: "capitalize" }}>
-                  ({repo.visibility.toLowerCase()})
-                </span>
-              </a>
-            </h1>
-            {repo.isFork && (
-              <p style={{ margin: 0, marginTop: 8 }}>
-                <code>[fork]</code>
-              </p>
-            )}
-          </Grid.Row>
-          <Grid.Col fluid gap={8}>
-            <p style={{ margin: 0 }}>{repo.shortDescription}</p>
-            {repo.lastPushedAt != null && (
-              <p
-                style={{
-                  margin: 0,
-                  fontSize: 14,
-                  color: NamedColors.TEXT_MUTED[themeScheme],
-                }}
-              >
-                Last push: {new Date(repo.lastPushedAt).toLocaleString()}
-              </p>
-            )}
-          </Grid.Col>
-        </Card>
-      ))}
-    </Grid.Row>
+      <script>{`
+        window.addEventListener(\`load\`, function(event) {
+          const container = document.querySelector(\`${selector}\`);
+          if (!container) return;
+          const containerWidth = container.clientWidth;
+          const cardMin = 300; // match your min-width
+          const gap = 8;
+          const cols = Math.max(1, Math.floor((containerWidth + gap) / (cardMin + gap)));
+          const rows = Math.ceil(${repositories.length} / cols);
+          const cardHeight = 200; // use computed or measured height
+          const height = rows * cardHeight + (rows - 1) * gap;
+          container.style.height = \`\${height}px\`;
+          container.style.minHeight = \`\${height}px\`;
+        });
+      `}</script>
+      <Grid.Row
+        fluid
+        gap={4}
+        alignItems={"stretch"}
+        justifyContent={"stretch"}
+        style={{ marginTop: 16 }}
+        className="container"
+      >
+        {repositories.map((repo) => (
+          <Card key={repo.id} themeScheme={themeScheme} className="card">
+            <Grid.Row fluid nowrap>
+              <h1 style={{ margin: 0, flex: 1 }}>
+                <a
+                  href={buildRouteLink(AppRoute.REPOSITORY_DETAILS, {
+                    orgSlug: repo.parentOrg.slug,
+                    repoSlug: repo.slug,
+                  })}
+                >
+                  {repo.parentOrg.displayName || repo.parentOrg.slug}
+                  {" / "}
+                  {repo.displayName || repo.slug}
+                  {" ∙ "}
+                  <span style={{ textTransform: "capitalize" }}>
+                    ({repo.visibility.toLowerCase()})
+                  </span>
+                </a>
+              </h1>
+              {repo.isFork && (
+                <p style={{ margin: 0, marginTop: 8 }}>
+                  <code>[fork]</code>
+                </p>
+              )}
+            </Grid.Row>
+            <Grid.Col fluid gap={8}>
+              <p style={{ margin: 0 }}>{repo.shortDescription}</p>
+              {repo.lastPushedAt != null && (
+                <p
+                  style={{
+                    margin: 0,
+                    fontSize: 14,
+                    color: NamedColors.TEXT_MUTED[themeScheme],
+                  }}
+                >
+                  Last push: {new Date(repo.lastPushedAt).toLocaleString()}
+                </p>
+              )}
+            </Grid.Col>
+          </Card>
+        ))}
+      </Grid.Row>
+    </>
   );
 };
 

"},{"type":"add","add":true,"newLine":77,"position":101,"content":"+ "},{"type":"add","add":true,"newLine":85,"position":109,"content":"+ {repositories.map((repo) => ("},{"type":"add","add":true,"newLine":86,"position":110,"content":"+ "},{"type":"add","add":true,"newLine":87,"position":111,"content":"+ "},{"type":"add","add":true,"newLine":88,"position":112,"content":"+

"},{"type":"add","add":true,"newLine":89,"position":113,"content":"+ "},{"type":"add","add":true,"newLine":95,"position":119,"content":"+ {repo.parentOrg.displayName || repo.parentOrg.slug}"},{"type":"add","add":true,"newLine":96,"position":120,"content":"+ {\" / \"}"},{"type":"add","add":true,"newLine":97,"position":121,"content":"+ {repo.displayName || repo.slug}"},{"type":"add","add":true,"newLine":98,"position":122,"content":"+ {\" ∙ \"}"},{"type":"add","add":true,"newLine":99,"position":123,"content":"+ "},{"type":"add","add":true,"newLine":100,"position":124,"content":"+ ({repo.visibility.toLowerCase()})"},{"type":"add","add":true,"newLine":101,"position":125,"content":"+ "},{"type":"add","add":true,"newLine":102,"position":126,"content":"+ "},{"type":"add","add":true,"newLine":103,"position":127,"content":"+

"},{"type":"add","add":true,"newLine":104,"position":128,"content":"+ {repo.isFork && ("},{"type":"add","add":true,"newLine":105,"position":129,"content":"+

"},{"type":"add","add":true,"newLine":106,"position":130,"content":"+ [fork]"},{"type":"add","add":true,"newLine":107,"position":131,"content":"+

"},{"type":"add","add":true,"newLine":108,"position":132,"content":"+ )}"},{"type":"add","add":true,"newLine":109,"position":133,"content":"+
"},{"type":"add","add":true,"newLine":110,"position":134,"content":"+ "},{"type":"add","add":true,"newLine":111,"position":135,"content":"+

{repo.shortDescription}

"},{"type":"add","add":true,"newLine":112,"position":136,"content":"+ {repo.lastPushedAt != null && ("},{"type":"add","add":true,"newLine":113,"position":137,"content":"+ "},{"type":"add","add":true,"newLine":120,"position":144,"content":"+ Last push: {new Date(repo.lastPushedAt).toLocaleString()}"},{"type":"add","add":true,"newLine":121,"position":145,"content":"+

"},{"type":"add","add":true,"newLine":122,"position":146,"content":"+ )}"},{"type":"add","add":true,"newLine":123,"position":147,"content":"+
"},{"type":"add","add":true,"newLine":124,"position":148,"content":"+
"},{"type":"add","add":true,"newLine":125,"position":149,"content":"+ ))}"},{"type":"add","add":true,"newLine":126,"position":150,"content":"+ "},{"type":"add","add":true,"newLine":127,"position":151,"content":"+ "},{"type":"normal","normal":true,"oldLine":102,"newLine":128,"position":152,"content":" );"},{"type":"normal","normal":true,"oldLine":103,"newLine":129,"position":153,"content":" };"},{"type":"normal","normal":true,"oldLine":104,"newLine":130,"position":154,"content":" "}],"oldStart":57,"oldLines":48,"newStart":59,"newLines":72}],"deletions":51,"additions":77,"index":["0698deb..8c01fa7","100644"]}],"themeScheme":"light","orgSlug":"ethicdevs","repoSlug":"gitfoss","commitHash":"deadfcfd857d09d73522b79ae600053332c59071"}, "Code$$0": {"code":"@@ -1,5 +1,5 @@\n {\n- \"_generatedAtUnix\": 1778833431035,\n+ \"_generatedAtUnix\": 1778835583155,\n \"_hashAlgorithm\": \"sha1\",\n \"_version\": 2,\n \"assets\": {\n","language":"diff","themeScheme":"light","style":{"borderTopLeftRadius":8,"borderTopRightRadius":8,"borderBottomLeftRadius":0,"borderBottomRightRadius":0}}, "Code$$1": {"code":"@@ -40,7 +40,7 @@\n \"pathSourceMap\": \"./public/.islands/PullRequestSourceSelect.bundle.js.map\"\n },\n \"RepositoriesList\": {\n- \"hash\": \"833571661d443206bbf57309f86566d5c8b87393\",\n+ \"hash\": \"fe287b3d71b1600333705fe6bf938f37181ba2f6\",\n \"pathSource\": \"./app/islands/RepositoriesList.tsx\",\n \"pathBundle\": \"./public/.islands/RepositoriesList.bundle.js\",\n \"pathSourceMap\": \"./public/.islands/RepositoriesList.bundle.js.map\"\n","language":"diff","themeScheme":"light","style":{"borderTopLeftRadius":0,"borderTopRightRadius":0,"borderBottomLeftRadius":8,"borderBottomRightRadius":8}}, "Code$$2": {"code":"@@ -19,15 +19,17 @@ export interface RepositoriesListProps {\n const RepositoriesList: ReactIsland<\n RepositoriesListProps & WithThemeSchemeProp\n > = ({ repositories, themeScheme }) => {\n+ const selector = \".container\";\n return (\n- \n+ <>\n \n- {repositories.map((repo) => (\n- \n- \n-

\n- \n- {repo.parentOrg.displayName || repo.parentOrg.slug}\n- {\" / \"}\n- {repo.displayName || repo.slug}\n- {\" ∙ \"}\n- \n- ({repo.visibility.toLowerCase()})\n- \n- \n-

\n- {repo.isFork && (\n-

\n- [fork]\n-

\n- )}\n-
\n- \n-

{repo.shortDescription}

\n- {repo.lastPushedAt != null && (\n- \n- Last push: {new Date(repo.lastPushedAt).toLocaleString()}\n-

\n- )}\n-
\n-
\n- ))}\n- \n+ \n+ \n+ {repositories.map((repo) => (\n+ \n+ \n+

\n+ \n+ {repo.parentOrg.displayName || repo.parentOrg.slug}\n+ {\" / \"}\n+ {repo.displayName || repo.slug}\n+ {\" ∙ \"}\n+ \n+ ({repo.visibility.toLowerCase()})\n+ \n+ \n+

\n+ {repo.isFork && (\n+

\n+ [fork]\n+

\n+ )}\n+
\n+ \n+

{repo.shortDescription}

\n+ {repo.lastPushedAt != null && (\n+ \n+ Last push: {new Date(repo.lastPushedAt).toLocaleString()}\n+

\n+ )}\n+
\n+
\n+ ))}\n+ \n+ \n );\n };\n \n","language":"diff","themeScheme":"light","style":{"borderTopLeftRadius":0,"borderTopRightRadius":0,"borderBottomLeftRadius":8,"borderBottomRightRadius":8}}, }; function afterRevival(revivalResults) { return undefined; } $IslandsRuntime.reviveIslands(islands, islandsProps, islandsEls) .then(afterRevival) .catch(afterRevival); })(IslandsRuntime);