Skip to content

Commit afc9de6

Browse files
committed
Link to Post from comment
1 parent c933567 commit afc9de6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/lib/comment-item.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useMutation } from "urql";
66

77
import { Auth } from "@supabase/ui";
88
import { TrashIcon } from "@heroicons/react/outline";
9-
9+
import { CalendarIcon, UserIcon } from "./icons";
1010
import { DocumentType, gql } from "../gql";
1111
import { timeAgo } from "./time-ago";
1212

@@ -16,6 +16,7 @@ const CommentItem_CommentFragment = gql(/* GraphQL */ `
1616
message
1717
createdAt
1818
post {
19+
id
1920
title
2021
}
2122
profile {
@@ -63,10 +64,19 @@ export function CommentItem(props: {
6364
<div className="flex items-center justify-between">
6465
<h3 className="text-sm font-medium">
6566
<Link href={`/profile/${props.comment.profile?.id}`}>
66-
<a className="text-gray-800">{props.comment.profile?.username}</a>
67+
<a className="text-gray-800 hover:text-green-500">
68+
{props.comment.profile?.username}
69+
</a>
6770
</Link>
6871
</h3>
69-
<p className="text-sm text-gray-500">{createdAt}</p>
72+
<p className="text-sm text-gray-500">
73+
<Link href={`/item/${props.comment.post?.id}`}>
74+
<a className="text-gray-800 hover:text-green-500 inline-flex items-center text-sm">
75+
<CalendarIcon className="w-4 h-4 mr-1" />
76+
{createdAt}
77+
</a>
78+
</Link>
79+
</p>
7080
</div>
7181
<p className="text-sm text-gray-500">
7282
{props.comment.message}

0 commit comments

Comments
 (0)