Skip to content

Commit

Permalink
UserAvatar size
Browse files Browse the repository at this point in the history
  • Loading branch information
wxh06 committed Jul 6, 2023
1 parent 7166ffb commit 8c2bb1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
13 changes: 2 additions & 11 deletions packages/viewer/src/app/r/[rid]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import prisma from "@/lib/prisma";
import { notFound } from "next/navigation";
import Link from "next/link";
import Image from "next/image";
import Content from "@/components/replies/Content";
import UserInfo from "@/components/UserInfo";
import UserAvatar from "@/components/UserAvatar";
import serializeReply from "@/lib/serialize-reply";
import { getUserAvatarUrl, getUserUrl } from "@/lib/luogu";

export const metadata = { title: "金玉良言 - 洛谷帖子保存站" };

Expand Down Expand Up @@ -67,15 +66,7 @@ export default async function Page({ params }: { params: { rid: string } }) {
className="position-absolute"
style={{ bottom: "-1.6em", left: ".8em" }}
>
<Link href={getUserUrl(reply.author.id)}>
<Image
src={getUserAvatarUrl(reply.author.id)}
className="rounded-circle shadow"
width={72}
height={72}
alt={reply.author.id.toString()}
/>
</Link>
<UserAvatar user={reply.author} size={72} />
</div>
<div
className="ps-6 position-absolute reply-meta-bottom"
Expand Down
6 changes: 4 additions & 2 deletions packages/viewer/src/components/UserAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import { getUserAvatarUrl, getUserUrl } from "@/lib/luogu";
export default function UserAvatar({
className,
decoratorShadow,
size = 64,
user: { id },
}: {
className?: string;
decoratorShadow?: string;
size?: number;
user: { id: number };
}) {
return (
Expand All @@ -19,8 +21,8 @@ export default function UserAvatar({
className={`rounded-circle shadow${
decoratorShadow ? `-${decoratorShadow}` : ""
}`}
width={64}
height={64}
width={size}
height={size}
alt={id.toString()}
/>
</Link>
Expand Down

0 comments on commit 8c2bb1f

Please sign in to comment.