feat: video item
This commit is contained in:
@@ -5,6 +5,9 @@ import { cn } from '@renderer/lib/utils'
|
||||
import { ArticleItem } from './article-item'
|
||||
import { SocialMediaItem } from './social-media-item'
|
||||
import { PictureItem } from './picture-item'
|
||||
import { VideoItem } from './video-item'
|
||||
|
||||
const gridMode = ['Pictures', 'Videos']
|
||||
|
||||
export function EntryColumn({
|
||||
activedList,
|
||||
@@ -31,6 +34,9 @@ export function EntryColumn({
|
||||
case 'Pictures':
|
||||
Item = PictureItem
|
||||
break
|
||||
case 'Videos':
|
||||
Item = VideoItem
|
||||
break
|
||||
default:
|
||||
Item = ArticleItem
|
||||
}
|
||||
@@ -56,7 +62,7 @@ export function EntryColumn({
|
||||
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'
|
||||
gridMode.includes(activedList?.type || '') && 'grid gap-2 grid-cols-2 md:grid-cols-3 lg:grid-cols-4 px-2'
|
||||
)}
|
||||
>
|
||||
{page.entries.map((entry) => (
|
||||
|
||||
@@ -20,10 +20,14 @@ export function PictureItem({
|
||||
</div>
|
||||
<div className="line-clamp-5 text-sm flex-1 px-2 pb-3 pt-1">
|
||||
<div className="font-medium line-clamp-2">{entry.title}</div>
|
||||
<div className="text-zinc-500 text-[13px]">
|
||||
{dayjs
|
||||
.duration(dayjs(entry.published_at).diff(dayjs(), 'minute'), 'minute')
|
||||
.humanize()}
|
||||
<div className='space-x-1 text-[13px]'>
|
||||
<span>{entry.author}</span>
|
||||
<span className="text-zinc-500">·</span>
|
||||
<span className="text-zinc-500">
|
||||
{dayjs
|
||||
.duration(dayjs(entry.published_at).diff(dayjs(), 'minute'), 'minute')
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import dayjs from '@renderer/lib/dayjs'
|
||||
|
||||
export function VideoItem({
|
||||
entry,
|
||||
}: {
|
||||
entry: any,
|
||||
}) {
|
||||
return (
|
||||
<div className='flex'>
|
||||
<div>
|
||||
<div className='flex gap-2 overflow-x-auto'>
|
||||
{entry.images?.slice(0, 1).map((image) => (
|
||||
<img
|
||||
key={image}
|
||||
src={image}
|
||||
className="w-full aspect-video shrink-0 rounded object-cover"
|
||||
loading="lazy"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div className="line-clamp-5 text-sm flex-1 px-2 pb-3 pt-1">
|
||||
<div className="font-medium line-clamp-2">{entry.title}</div>
|
||||
<div className='space-x-1 text-[13px]'>
|
||||
<span>{entry.author}</span>
|
||||
<span className="text-zinc-500">·</span>
|
||||
<span className="text-zinc-500">
|
||||
{dayjs
|
||||
.duration(dayjs(entry.published_at).diff(dayjs(), 'minute'), 'minute')
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user