Skip to content

Commit

Permalink
Addedback in the count for the favorites
Browse files Browse the repository at this point in the history
  • Loading branch information
hqasmei committed Jul 17, 2024
1 parent 871bef0 commit 702d66a
Showing 1 changed file with 48 additions and 20 deletions.
68 changes: 48 additions & 20 deletions src/components/portfolio-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,30 @@ export default function PortfolioCard({

<div className="flex flex-row items-center absolute z-10 bottom-2 right-0">
{session.isLoggedIn ? (
<div className="flex items-center gap-3">
<button onClick={handleFavoriteClick}>
<Heart
size={18}
className={cn(
'stroke-muted-foreground group-hover:stroke-emerald-500 duration-200',
isFavorited && 'fill-emerald-500 stroke-emerald-500',
)}
/>
</button>
<div className="flex items-center gap-4">
<div className="flex items-center gap-2">
<button onClick={handleFavoriteClick}>
<Heart
size={18}
className={cn(
'stroke-muted-foreground group-hover:stroke-emerald-500 duration-200',
isFavorited && 'fill-emerald-500 stroke-emerald-500',
)}
/>
</button>
{!isFavoriteCard &&
portfolio.favoritesCount &&
portfolio.favoritesCount !== 0 ? (
<span
className={cn(
'text-muted-foreground group-hover:text-emerald-500 duration-200',
isFavorited && 'text-emerald-500',
)}
>
{portfolio.favoritesCount ?? 0}
</span>
) : null}
</div>
<Link href={portfolio.link} target="_blank">
<ExternalLink
size={20}
Expand All @@ -113,18 +127,32 @@ export default function PortfolioCard({
</Link>
</div>
) : (
<div className="flex items-center gap-3">
<button>
<SignInButton mode="modal">
<Heart
size={20}
<div className="flex items-center gap-4">
<div className="flex items-center gap-2">
<button>
<SignInButton mode="modal">
<Heart
size={20}
className={cn(
'stroke-muted-foreground hover:stroke-emerald-500 duration-200',
isFavorited && 'fill-emerald-500 stroke-emerald-500',
)}
/>
</SignInButton>
</button>
{!isFavoriteCard &&
portfolio.favoritesCount &&
portfolio.favoritesCount !== 0 ? (
<span
className={cn(
'stroke-muted-foreground hover:stroke-emerald-500 duration-200',
isFavorited && 'fill-emerald-500 stroke-emerald-500',
'text-muted-foreground group-hover:text-emerald-500 duration-200',
isFavorited && 'text-emerald-500',
)}
/>
</SignInButton>
</button>
>
{portfolio.favoritesCount ?? 0}
</span>
) : null}
</div>
<Link href={portfolio.link} target="_blank">
<ExternalLink
size={20}
Expand Down

0 comments on commit 702d66a

Please sign in to comment.