From 5f1fcfc0ff3dd74de5a0e8a02c734449a06118fc Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 16 Apr 2024 13:12:59 +0800 Subject: [PATCH] feat: entry column active --- src/renderer/src/components/entry-column.tsx | 28 +++++++++++++++----- src/renderer/src/pages/index.tsx | 5 ++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/components/entry-column.tsx b/src/renderer/src/components/entry-column.tsx index 38f16cb68..fc0dcb779 100644 --- a/src/renderer/src/components/entry-column.tsx +++ b/src/renderer/src/components/entry-column.tsx @@ -2,16 +2,25 @@ import { useEntries } from '@renderer/lib/entries' import { ActivedList } from '@renderer/lib/types' import dayjs from '@renderer/lib/dayjs' import { m } from 'framer-motion' +import { cn } from '@renderer/lib/utils' -export function EntryColumn({ activedList }: { activedList: ActivedList }) { +export function EntryColumn({ + activedList, + activedEntry, + setActivedEntry, +}: { + activedList: ActivedList, + activedEntry: number | null, + setActivedEntry: (value: number | null) => void +}) { const entries = useEntries({ type: activedList?.level, id: activedList?.id }) return ( -
-
+
setActivedEntry(null)}> +
{activedList?.name}
{entries.data?.pages?.[0].total} Items @@ -26,12 +35,19 @@ export function EntryColumn({ activedList }: { activedList: ActivedList }) { exit={{ y: -100, opacity: 0 }} > {page.entries.map((entry) => ( -
+
{ + e.stopPropagation() + setActivedEntry(entry.id) + }} + > -
+
{dayjs .duration(dayjs(entry.published_at).diff(dayjs(), 'minute'), 'minute') @@ -39,7 +55,7 @@ export function EntryColumn({ activedList }: { activedList: ActivedList }) { ago
{entry.title}
-
{entry.text}
+
{entry.text}
{entry.images?.[0] && ( (null) + const [activedEntry, setActivedEntry] = useState(null) return (
setActivedList(null)}>
-
- +
+
Three