Skip to content

Commit

Permalink
fix: adjusts scroll position
Browse files Browse the repository at this point in the history
  • Loading branch information
akoenig committed Apr 6, 2024
1 parent bbfedae commit 055d9fa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
27 changes: 27 additions & 0 deletions app/components/workflow-cards.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Link } from "@remix-run/react";
import { WorkflowCard } from "./workflow-card";

type Props = Readonly<{
workflows: ReadonlyArray<{
id: string;
name: string;
description: string;
category: string;
title: string;
}>;
}>;

export function WorkflowCards(props: Props) {
return props.workflows.map((workflow) => (
<Link
key={workflow.id}
to={`/${workflow.category}/${workflow.name}/details`}
prefetch="intent"
>
<WorkflowCard
workflow={workflow}
footer={<span className="text-primary text-sm">Use Workflow</span>}
/>
</Link>
));
}
20 changes: 3 additions & 17 deletions app/routes/_frontend.$category._index/route.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getCategories } from "#workflows";
import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node";
import { Link, json, redirect, useLoaderData } from "@remix-run/react";
import { WorkflowCard } from "~/components/workflow-card";
import { json, redirect, useLoaderData } from "@remix-run/react";
import { WorkflowCards } from "~/components/workflow-cards";
import { WorkflowSwitcher } from "~/components/workflow-switcher";
import { getBaseUrl } from "~/utils/get-base-url.server";
import { getWorkflows } from "./query";
Expand Down Expand Up @@ -102,21 +102,7 @@ export default function Index() {
<WorkflowSwitcher categories={loaderData.categories} />
</div>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
{loaderData.workflows.map((workflow) => (
<Link
key={workflow.id}
to={`/${workflow.category}/${workflow.name}/details`}
preventScrollReset={true}
prefetch="intent"
>
<WorkflowCard
workflow={workflow}
footer={
<span className="text-primary text-sm">Use Workflow</span>
}
/>
</Link>
))}
<WorkflowCards workflows={loaderData.workflows} />
</div>
</>
);
Expand Down

0 comments on commit 055d9fa

Please sign in to comment.