Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix/928_added back arrow button to the solution-detail component (#936)

Prathamesh sonjeae2bd88698ba
diff --git a/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-detail.tsx b/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-detail.tsx
index b8648228..8fc58264 100644
--- a/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-detail.tsx
+++ b/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-detail.tsx
@@ -9,7 +9,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@repo/ui/components/too
import { TypographyLarge } from '@repo/ui/components/typography/large';
import { toast } from '@repo/ui/components/use-toast';
import { UserBadge } from '@repo/ui/components/user-badge';
-import { Calendar, Flag, Pin, Share, X, Trash, Pencil } from '@repo/ui/icons';
+import { Calendar, Flag, Pin, Share, Trash, ArrowLeft, Pencil } from '@repo/ui/icons';
import clsx from 'clsx';
import Link from 'next/link';
import type { ChallengeSolution } from '~/app/[locale]/challenge/[slug]/solutions/[solutionId]/page';
@@ -50,14 +50,14 @@ export function SolutionDetails({ solution }: Props) {
return (
<div className="relative h-full">
<div className="relative flex h-full flex-col">
- <div className="bg-background/90 dark:bg-muted/90 sticky right-0 top-0 flex w-full border-b border-zinc-300 p-2 backdrop-blur-sm dark:border-zinc-700">
- <Link href={`/challenge/${slug}/solutions`}>
- <X className="stroke-gray-500 hover:stroke-gray-400" size={20} />
- </Link>
- </div>
<div className="custom-scrollable-element flex-1 overflow-y-auto px-4 pb-16 pt-3">
<div className="mb-5 flex flex-col gap-3">
- <div className="flex items-center justify-between">
+ <div className="flex items-center gap-3">
+ <Link href={`/challenge/${slug}/solutions`} className="h-7 w-7">
+ <div className="rounded-full p-1 hover:bg-gray-200 hover:bg-opacity-10">
+ <ArrowLeft className="stroke-gray-500" size={20} />
+ </div>
+ </Link>
<div className="flex items-center gap-2">
<Avatar className="h-7 w-7">
<AvatarImage alt="github profile picture" src={solution.user?.image ?? ''} />
@@ -91,6 +91,8 @@ export function SolutionDetails({ solution }: Props) {
<Calendar className="h-4 w-4" />
<span className="text-xs">{getRelativeTime(solution.createdAt)}</span>
</div>
+ </div>
+ <div className="flex items-center gap-3">
<Vote
voteCount={solution._count.vote}
initialHasVoted={solution.vote.length > 0}
diff --git a/packages/ui/src/icons.ts b/packages/ui/src/icons.ts
index 6333e283..f698e42c 100644
--- a/packages/ui/src/icons.ts
+++ b/packages/ui/src/icons.ts
@@ -66,4 +66,5 @@ export {
Text,
FlaskConical,
History,
+ ArrowLeft,
} from 'lucide-react';