Skip to content

Commit b352420

Browse files
Merge pull request #81 from subhamBharadwaz/enhancement/code-refactor
style: 🎨 Entry Card Mobile UX
2 parents 16b344b + 765e683 commit b352420

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

src/app/(journal)/_components/entry-operations.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ export function EntryOperations({
150150
<Button
151151
size="icon"
152152
onClick={() => setShowDeleteAlert(true)}
153-
className="rounded-full opacity-0 transition-all duration-300 hover:-translate-y-0.5 group-hover:opacity-100"
153+
className="rounded-full opacity-100 transition-all duration-300 hover:-translate-y-0.5 group-hover:opacity-100 md:opacity-0"
154154
>
155155
<Trash className="size-4" />
156156
</Button>
157157
<Button
158158
size="icon"
159159
onClick={handleBookmarkToggle}
160160
disabled={isTransitionPending}
161-
className="rounded-full opacity-0 transition-all duration-300 hover:-translate-y-0.5 group-hover:opacity-100"
161+
className="rounded-full opacity-100 transition-all duration-300 hover:-translate-y-0.5 group-hover:opacity-100 md:opacity-0"
162162
>
163163
<BookmarkIcon
164164
className={cn(

src/app/(journal)/_components/journal-entry-card.tsx

+15-13
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,27 @@ export function JournalEntryCard({
6161
className
6262
)}
6363
>
64-
<Link
65-
href={`/editor/${entry.id}`}
66-
className="text-lg font-semibold hover:underline lg:text-xl"
67-
>
68-
{" "}
69-
{entry.title}
70-
</Link>
64+
<div className="grow">
65+
<Link
66+
href={`/editor/${entry.id}`}
67+
className="text-lg font-semibold hover:underline lg:text-xl"
68+
>
69+
{" "}
70+
{entry.title}
71+
</Link>
72+
<p className="text-sm text-muted-foreground lg:text-base">
73+
{/* @ts-ignore */}
74+
{entry.content?.blocks[0]?.data.text}
75+
</p>
76+
</div>
7177
{isBookmarked && (
7278
<div className="absolute right-4 top-0 rounded-full bg-muted p-2">
7379
<BookmarkIcon className="size-4 fill-foreground text-foreground" />
7480
</div>
7581
)}
76-
<p className="text-sm text-muted-foreground lg:text-base">
77-
{/* @ts-ignore */}
78-
{entry.content?.blocks[0]?.data.text}
79-
</p>
8082

81-
<div className="absolute bottom-5 right-4 flex items-center justify-between transition-all duration-300 group-hover:block">
82-
<p className="block text-sm text-muted-foreground transition-all duration-300 group-hover:hidden">
83+
<div className="mt-auto flex w-full items-center justify-between self-end transition-all duration-300 group-hover:block">
84+
<p className="text-sm text-muted-foreground transition-all duration-300 group-hover:hidden">
8385
{formatDate(entry.createdAt?.toDateString())}
8486
</p>
8587
<EntryOperations

0 commit comments

Comments
 (0)