From 54489944ddf3e75b451824978dd55aa5b576ed82 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 16 Apr 2024 15:34:43 +0800 Subject: [PATCH] feat: picture item --- .../components/entry-column/article-item.tsx | 2 +- .../src/components/entry-column/index.tsx | 11 +++++-- .../components/entry-column/picture-item.tsx | 32 +++++++++++++++++++ .../entry-column/social-media-item.tsx | 2 +- src/renderer/src/lib/entries.ts | 4 +-- src/renderer/src/pages/index.tsx | 8 +++-- 6 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 src/renderer/src/components/entry-column/picture-item.tsx diff --git a/src/renderer/src/components/entry-column/article-item.tsx b/src/renderer/src/components/entry-column/article-item.tsx index 1bc3a4398..846d54da5 100644 --- a/src/renderer/src/components/entry-column/article-item.tsx +++ b/src/renderer/src/components/entry-column/article-item.tsx @@ -6,7 +6,7 @@ export function ArticleItem({ entry: any, }) { return ( -
+
setActivedEntry(null)}> -
+
{activedList?.name}
{entries.data?.pages?.[0].total} Items @@ -51,11 +55,14 @@ export function EntryColumn({ initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} + className={cn( + activedList?.type === 'Pictures' && 'grid gap-2 grid-cols-2 md:grid-cols-3 lg:grid-cols-4 px-2' + )} > {page.entries.map((entry) => (
{ e.stopPropagation() setActivedEntry(entry.id) diff --git a/src/renderer/src/components/entry-column/picture-item.tsx b/src/renderer/src/components/entry-column/picture-item.tsx new file mode 100644 index 000000000..1f626a010 --- /dev/null +++ b/src/renderer/src/components/entry-column/picture-item.tsx @@ -0,0 +1,32 @@ +import dayjs from '@renderer/lib/dayjs' + +export function PictureItem({ + entry, +}: { + entry: any, +}) { + return ( +
+
+
+ {entry.images?.slice(0, 1).map((image) => ( + + ))} +
+
+
{entry.title}
+
+ {dayjs + .duration(dayjs(entry.published_at).diff(dayjs(), 'minute'), 'minute') + .humanize()} +
+
+
+
+ ) +} diff --git a/src/renderer/src/components/entry-column/social-media-item.tsx b/src/renderer/src/components/entry-column/social-media-item.tsx index 8a102c239..9d3d1d146 100644 --- a/src/renderer/src/components/entry-column/social-media-item.tsx +++ b/src/renderer/src/components/entry-column/social-media-item.tsx @@ -6,7 +6,7 @@ export function SocialMediaItem({ entry: any, }) { return ( -
+
({ level: 'type', @@ -18,10 +20,12 @@ export function Component() {
-
+
-
Three
+ {!wideMode.includes(activedList?.type || '') && ( +
Three
+ )}
) }