refactor: create proper article links

This commit is contained in:
Derrick Hammer 2023-12-24 11:43:41 -05:00
parent 6d6f684b47
commit d3b9cadb54
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 7 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import { formatDate } from "@/utils";
import * as ScrollArea from "@radix-ui/react-scroll-area";
import { useEffect, useState } from "react";
import { Article } from "@/lib/prisma";
import { useFetcher } from "@remix-run/react";
import { Link, useFetcher } from "@remix-run/react";
const Feed = ({
className,
@ -112,7 +112,7 @@ const Feed = ({
{formatDate(item.createdAt)}
</span>
<p className="inline-block text-white w-[25ch] flex-auto">
{item.title}
<Link to={`/article/${item.cid}`}>{item.title}</Link>
</p>
</article>
);

View File

@ -55,7 +55,10 @@ const Page = () => {
<span className="text-sm text-gray-400">
{formatDate(item.timestamp)}
</span>
<h3 className="text-md font-semibold text-white">{item.title}</h3>
<h3 className="text-md font-semibold text-white">
{" "}
<Link to={`/article/${item.cid}`}>{item.title}</Link>
</h3>
</Link>
))}
<Link to={`/search?q=${encodeURIComponent(query)}`}>

1
app/types.d.ts vendored
View File

@ -4,6 +4,7 @@ export type SearchResult = {
title: string;
description: string;
slug: string;
cid: string;
};
export type SelectOptions = {