fix: align ItemStateLess styles with Item components across all view types

- Fixed ArticleItemStateLess to match ListItem template styling
- Fixed AudioItemStateLess to use ArticleItemStateLess (same ListItem pattern)
- Fixed NotificationItemStateLess for simple ListItem pattern (no description)
- Fixed SocialMediaItemStateLess to match custom layout with 32px avatar
- Fixed VideoItemStateLess to match GridItem template with accent dot
- Fixed PictureItemStateLess minor cleanup for masonry layout
- Updated all components to use consistent UIKit colors (text-text, text-text-secondary)
- Fixed ViewSelectorRadioGroup preview layout for grid-based views
- Fixed FeedForm button variant from "text" to "ghost"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DIYgod
2025-09-01 17:54:29 +08:00
co-authored by Claude
parent cfc68bee8d
commit e2d007fd9c
10 changed files with 188 additions and 236 deletions
@@ -315,7 +315,7 @@ const FeedInnerForm = ({
</div>
<FormControl>
<div className="flex gap-2">
<Input {...field} />
<Input placeholder={feed.title || undefined} {...field} />
<Button
buttonClassName="shrink-0"
type="button"
@@ -426,7 +426,7 @@ const FeedInnerForm = ({
{isSubscribed && (
<Button
type="button"
variant="text"
variant="ghost"
onClick={() => {
dismiss()
}}
@@ -17,41 +17,37 @@ ArticleItem.wrapperClassName = readableContentMaxWidth
export function ArticleItemStateLess({ entry, feed }: EntryItemStatelessProps) {
return (
<div className="text-text relative select-none rounded-md transition-colors">
<div className="relative">
<div className="group relative flex py-4 pl-3 pr-2">
<FeedIcon className="mr-2 size-5 rounded-sm" feed={feed} fallback />
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
<div className="text-text-secondary flex gap-1 text-[10px] font-bold">
<FeedTitle feed={feed} />
<span>·</span>
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
</div>
<div className="relative my-1 break-words font-medium">{entry.title}</div>
<div className="text-text-secondary mt-1.5 text-[13px]">{entry.description}</div>
</div>
{entry.media?.[0] ? (
<Media
thumbnail
src={entry.media[0].url}
type={entry.media[0].type}
previewImageUrl={entry.media[0].preview_image_url}
className="ml-2 size-20 overflow-hidden rounded"
mediaContainerClassName={"w-auto h-auto rounded"}
loading="lazy"
proxy={{
width: 160,
height: 160,
}}
height={entry.media[0].height}
width={entry.media[0].width}
blurhash={entry.media[0].blurhash}
/>
) : (
<Skeleton className="ml-2 size-20 overflow-hidden rounded" />
)}
<div className="group relative flex py-4">
<FeedIcon feed={feed} fallback className="mr-2 size-5" />
<div className="-mt-0.5 min-w-0 flex-1 text-sm leading-tight">
<div className="text-text-secondary flex gap-1 text-[10px] font-bold">
<FeedTitle feed={feed} />
<span>·</span>
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
</div>
<div className="text-text relative my-0.5 truncate break-words font-medium">
{entry.title}
</div>
<div className="text-text-secondary truncate text-[13px]">{entry.description}</div>
</div>
{entry.media?.[0] && (
<Media
thumbnail
src={entry.media[0].url}
type={entry.media[0].type}
previewImageUrl={entry.media[0].preview_image_url}
className="ml-2 size-20 shrink-0 overflow-hidden rounded"
mediaContainerClassName="w-auto h-auto rounded"
loading="lazy"
proxy={{
width: 160,
height: 160,
}}
height={entry.media[0].height}
width={entry.media[0].width}
blurhash={entry.media[0].blurhash}
/>
)}
</div>
)
}
@@ -1,12 +1,9 @@
import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
import { RelativeTime } from "~/components/ui/datetime"
import { Media } from "~/components/ui/media/Media"
import { ListItem } from "~/modules/entry-column/templates/list-item-template"
import { FeedTitle } from "~/modules/feed/feed-title"
import { readableContentMaxWidth } from "../styles"
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"
import type { UniversalItemProps } from "../types"
export function AudioItem({ entryId, entryPreview, translation }: UniversalItemProps) {
return <ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} />
@@ -14,49 +11,6 @@ export function AudioItem({ entryId, entryPreview, translation }: UniversalItemP
AudioItem.wrapperClassName = readableContentMaxWidth
export function AudioItemStateLess({ entry, feed }: EntryItemStatelessProps) {
return (
<div className="relative mx-auto w-full max-w-lg select-none rounded-md">
<div className="relative">
<div className="group relative flex py-4 pl-3 pr-2">
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
<div className="text-text-secondary flex gap-1 text-[10px] font-bold">
<FeedTitle feed={feed} />
<span>·</span>
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
</div>
<div className="relative my-0.5 line-clamp-3 break-words font-medium">
{entry.description}
</div>
</div>
<div className="relative ml-2 size-20 shrink-0">
{entry.media?.[0] ? (
<Media
thumbnail
src={entry.media[0].url}
type={entry.media[0].type}
previewImageUrl={entry.media[0].preview_image_url}
className="mr-2 size-20 shrink-0 overflow-hidden rounded-sm"
mediaContainerClassName={"w-auto h-auto rounded"}
loading="lazy"
proxy={{
width: 160,
height: 160,
}}
height={entry.media[0].height}
width={entry.media[0].width}
blurhash={entry.media[0].blurhash}
/>
) : (
<Skeleton className="mr-2 size-20 shrink-0 overflow-hidden rounded-sm" />
)}
</div>
</div>
</div>
</div>
)
}
export const AudioItemSkeleton = (
<div className="relative mx-auto w-full select-none rounded-md">
<div className="relative">
@@ -16,17 +16,16 @@ NotificationItem.wrapperClassName = readableContentMaxWidth
export function NotificationItemStateLess({ entry, feed }: EntryItemStatelessProps) {
return (
<div className="relative w-full max-w-lg select-none">
<div className="group relative flex py-4 pl-3 pr-2">
<FeedIcon feed={feed} fallback />
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
<div className="text-text-secondary flex gap-1 text-[10px] font-bold">
<FeedTitle feed={feed} />
<span>·</span>
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
</div>
<div className="relative my-0.5 break-words">{entry.title}</div>
<div className="cursor-menu group relative flex py-4">
<FeedIcon feed={feed} fallback className="mr-2 size-5" />
<div className="-mt-0.5 min-w-0 flex-1 text-sm leading-tight">
<div className="text-text-secondary flex gap-1 text-[10px] font-bold">
<FeedTitle feed={feed} />
<span>·</span>
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
</div>
<div className="text-text relative my-0.5 truncate break-words font-medium">
{entry.title}
</div>
</div>
</div>
@@ -2,9 +2,7 @@ import {
MasonryItemsAspectRatioContext,
MasonryItemsAspectRatioSetterContext,
MasonryItemWidthContext,
useMasonryItemWidth,
} from "@follow/components/ui/masonry/contexts.jsx"
import { Masonry } from "@follow/components/ui/masonry/index.js"
import { useMeasure } from "@follow/hooks"
import { useState } from "react"
@@ -13,30 +11,6 @@ import { MediaContainerWidthProvider } from "~/components/ui/media/MediaContaine
import type { EntryItemStatelessProps } from "../types"
const MasonryRender = ({ data }) => {
const { url, type, previewImageUrl, height, width, blurhash } = data
const itemWidth = useMasonryItemWidth()
return (
<Media
thumbnail
src={url}
type={type}
previewImageUrl={previewImageUrl}
className="size-full overflow-hidden"
mediaContainerClassName={"w-auto h-auto rounded"}
loading="lazy"
proxy={{
width: itemWidth,
height: 0,
}}
height={height}
width={width}
blurhash={blurhash}
/>
)
}
export function PictureItemStateLess({ entry }: EntryItemStatelessProps) {
const [masonryItemsRadio, setMasonryItemsRadio] = useState<Record<string, number>>({})
@@ -54,19 +28,25 @@ export function PictureItemStateLess({ entry }: EntryItemStatelessProps) {
const currentItemWidth = (bounds.width - 12) / 2
return (
<div className="text-text relative w-full select-none rounded-md transition-colors" ref={ref}>
<div className="text-text relative w-full select-none" ref={ref}>
<MasonryItemWidthContext value={currentItemWidth}>
{/* eslint-disable-next-line @eslint-react/no-context-provider */}
<MasonryItemsAspectRatioContext.Provider value={masonryItemsRadio}>
<MasonryItemsAspectRatioSetterContext value={setMasonryItemsRadio}>
<MediaContainerWidthProvider width={currentItemWidth}>
<Masonry
items={mediaItems}
columnGutter={12}
columnWidth={currentItemWidth}
columnCount={2}
overscanBy={2}
render={MasonryRender}
<Media
thumbnail
src={mediaItems[0]?.url}
type={mediaItems[0]?.type || "photo"}
previewImageUrl={mediaItems[0]?.previewImageUrl}
className="size-full overflow-hidden"
mediaContainerClassName={"w-auto h-auto rounded"}
loading="lazy"
proxy={{
width: 600,
height: 0,
}}
blurhash={mediaItems[0]?.blurhash}
/>
</MediaContainerWidthProvider>
</MasonryItemsAspectRatioSetterContext>
@@ -141,42 +141,48 @@ SocialMediaItem.wrapperClassName = readableContentMaxWidth
export function SocialMediaItemStateLess({ entry, feed }: EntryItemStatelessProps) {
return (
<div className="relative select-none rounded-md text-zinc-700 transition-colors dark:text-neutral-400">
<div className="relative">
<div className="group relative flex px-8 py-6">
<FeedIcon className="mr-2 size-9" feed={feed} fallback />
<div className="ml-2 min-w-0 flex-1">
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm">
<div className="flex space-x-1">
<FeedTitle feed={feed} />
<span className="text-zinc-500">·</span>
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
</div>
<div className="relative mt-0.5 text-sm">{entry.description}</div>
</div>
<div className="mt-2 flex gap-2 overflow-x-auto">
{entry.media?.slice(0, 2).map((media) => (
<Media
key={media.url}
thumbnail
src={media.url}
type={media.type}
previewImageUrl={media.preview_image_url}
className="size-28 overflow-hidden rounded"
mediaContainerClassName={"w-auto h-auto rounded"}
loading="lazy"
proxy={{
width: 160,
height: 160,
}}
height={media.height}
width={media.width}
blurhash={media.blurhash}
/>
))}
<div className="relative flex py-4">
<FeedIcon fallback feed={feed} size={32} className="mr-2 mt-1" />
<div className="min-w-0 flex-1">
<div className="-mt-0.5 flex-1 text-sm">
<div className="flex select-none flex-wrap space-x-1 leading-6">
<span className="inline-flex min-w-0 items-center gap-1 text-base font-semibold">
<FeedTitle feed={feed} />
</span>
<span className="text-zinc-500">·</span>
<span className="text-zinc-500">
<RelativeTime date={entry.publishedAt} />
</span>
</div>
<div className="relative mt-1 text-base">
<div className="prose dark:prose-invert prose-blockquote:mt-0 cursor-auto select-text truncate align-middle text-sm leading-relaxed">
{entry.description}
</div>
</div>
</div>
{entry.media && entry.media.length > 0 && (
<div className="mt-4 flex gap-[8px] overflow-x-auto pb-2">
{entry.media.slice(0, 3).map((media) => (
<Media
key={media.url}
thumbnail
src={media.url}
type={media.type}
previewImageUrl={media.preview_image_url}
className="size-28 shrink-0 rounded object-cover"
mediaContainerClassName="w-auto h-auto rounded"
loading="lazy"
proxy={{
width: 160,
height: 160,
}}
height={media.height}
width={media.width}
blurhash={media.blurhash}
/>
))}
</div>
)}
</div>
</div>
)
@@ -128,45 +128,51 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP
export function VideoItemStateLess({ entry, feed }: EntryItemStatelessProps) {
return (
<div className="text-text relative mx-auto w-full max-w-lg rounded-md transition-colors">
<div className="relative">
<div className="p-1.5">
<div className="w-full">
<div className="overflow-x-auto">
{entry.media?.[0] ? (
<Media
thumbnail
src={entry.media[0].url}
type={entry.media[0].type}
previewImageUrl={entry.media[0].preview_image_url}
className="aspect-video w-full shrink-0 overflow-hidden"
mediaContainerClassName={"w-auto h-auto rounded"}
loading="lazy"
proxy={{
width: 0,
height: 0,
}}
height={entry.media[0].height}
width={entry.media[0].width}
blurhash={entry.media[0].blurhash}
/>
) : (
<Skeleton className="aspect-video w-full shrink-0 overflow-hidden" />
)}
</div>
</div>
<div className="relative flex-1 px-2 pb-3 pt-1 text-sm">
<div className="relative mb-1 mt-1.5 truncate font-medium leading-none">
{entry.title}
</div>
<div className="text-text-secondary mt-1 flex items-center gap-1 truncate text-[13px]">
<FeedIcon feed={feed} fallback className="size-4" />
<FeedTitle feed={feed} />
<span className="text-material-opaque">·</span>
{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}
<div className="p-1.5">
<div className="w-full">
<div className="relative overflow-x-auto">
{entry.media?.[0] ? (
<Media
thumbnail
src={entry.media[0].url}
type={entry.media[0].type}
previewImageUrl={entry.media[0].preview_image_url}
className="aspect-video w-full shrink-0 rounded-md object-cover"
mediaContainerClassName="w-auto h-auto rounded"
loading="lazy"
proxy={{
width: 640,
height: 360,
}}
height={entry.media[0].height}
width={entry.media[0].width}
blurhash={entry.media[0].blurhash}
/>
) : (
<div className="center bg-material-medium text-text-secondary aspect-video w-full flex-col gap-1 rounded-md text-xs">
<i className="i-mgc-sad-cute-re size-6" />
No media available
</div>
)}
</div>
</div>
<div className="relative px-2 text-sm">
<div className="flex items-center">
<div className="bg-accent mr-1 size-1.5 shrink-0 self-center rounded-full duration-200" />
<div className="relative mb-1 mt-1.5 flex w-full items-center gap-1 truncate font-medium">
<span className="min-w-0 grow truncate">{entry.title}</span>
</div>
</div>
<div className="flex items-center gap-1 truncate text-[13px]">
<FeedIcon fallback noMargin className="flex" feed={feed} size={18} />
<span className="min-w-0 truncate pl-1">
<FeedTitle feed={feed} />
</span>
<span className="text-zinc-500">·</span>
<span className="text-zinc-500">
{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}
</span>
</div>
</div>
</div>
)
@@ -237,45 +237,51 @@ const PreviewVideoModalContent: ModalContentComponent<{
export function VideoItemStateLess({ entry, feed }: EntryItemStatelessProps) {
return (
<div className="text-text relative mx-auto w-full max-w-lg rounded-md transition-colors">
<div className="relative">
<div className="p-1.5">
<div className="w-full">
<div className="overflow-x-auto">
{entry.media?.[0] ? (
<Media
thumbnail
src={entry.media[0].url}
type={entry.media[0].type}
previewImageUrl={entry.media[0].preview_image_url}
className="aspect-video w-full shrink-0 overflow-hidden"
mediaContainerClassName={"w-auto h-auto rounded"}
loading="lazy"
proxy={{
width: 0,
height: 0,
}}
height={entry.media[0].height}
width={entry.media[0].width}
blurhash={entry.media[0].blurhash}
/>
) : (
<Skeleton className="aspect-video w-full shrink-0 overflow-hidden" />
)}
</div>
</div>
<div className="relative flex-1 px-2 pb-3 pt-1 text-sm">
<div className="relative mb-1 mt-1.5 truncate font-medium leading-none">
{entry.title}
</div>
<div className="text-text-secondary mt-1 flex items-center gap-1 truncate text-[13px]">
<FeedIcon feed={feed} fallback className="size-4" />
<FeedTitle feed={feed} />
<span className="text-material-opaque">·</span>
{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}
<div className="p-1.5">
<div className="w-full">
<div className="relative overflow-x-auto">
{entry.media?.[0] ? (
<Media
thumbnail
src={entry.media[0].url}
type={entry.media[0].type}
previewImageUrl={entry.media[0].preview_image_url}
className="aspect-video w-full shrink-0 rounded-md object-cover"
mediaContainerClassName="w-auto h-auto rounded"
loading="lazy"
proxy={{
width: 640,
height: 360,
}}
height={entry.media[0].height}
width={entry.media[0].width}
blurhash={entry.media[0].blurhash}
/>
) : (
<div className="center bg-material-medium text-text-secondary aspect-video w-full flex-col gap-1 rounded-md text-xs">
<i className="i-mgc-sad-cute-re size-6" />
No media available
</div>
)}
</div>
</div>
<div className="relative px-2 text-sm">
<div className="flex items-center">
<div className="bg-accent mr-1 size-1.5 shrink-0 self-center rounded-full duration-200" />
<div className="relative mb-1 mt-1.5 flex w-full items-center gap-1 truncate font-medium">
<span className="min-w-0 grow truncate">{entry.title}</span>
</div>
</div>
<div className="flex items-center gap-1 truncate text-[13px]">
<FeedIcon fallback noMargin className="flex" feed={feed} size={18} />
<span className="min-w-0 truncate pl-1">
<FeedTitle feed={feed} />
</span>
<span className="text-zinc-500">·</span>
<span className="text-zinc-500">
{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}
</span>
</div>
</div>
</div>
)
@@ -3,7 +3,6 @@ import type { FC } from "react"
import { memo } from "react"
import { ArticleItemStateLess } from "./Items/article-item"
import { AudioItemStateLess } from "./Items/audio-item"
import { NotificationItemStateLess } from "./Items/notification-item"
import { PictureItemStateLess } from "./Items/picture-item-stateless"
import { SocialMediaItemStateLess } from "./Items/social-media-item"
@@ -15,7 +14,7 @@ const StatelessItemMap = {
[FeedViewType.SocialMedia]: SocialMediaItemStateLess,
[FeedViewType.Pictures]: PictureItemStateLess,
[FeedViewType.Videos]: VideoItemStateLess,
[FeedViewType.Audios]: AudioItemStateLess,
[FeedViewType.Audios]: ArticleItemStateLess,
[FeedViewType.Notifications]: NotificationItemStateLess,
}
@@ -63,8 +63,14 @@ export const ViewSelectorRadioGroup = ({
))}
</CardHeader>
{showPreview && (
<CardContent className="relative flex w-full flex-col gap-2">
{entries.slice(0, 2).map((entry) => (
<CardContent
className={
views[view || FeedViewType.Articles]?.gridMode
? "relative grid w-full grid-cols-3 flex-col gap-2 pb-4"
: "relative flex w-full flex-col gap-2 pb-0"
}
>
{entries.slice(0, 3).map((entry) => (
<EntryItemStateless entry={entry} feed={feed} view={view} key={entry.guid} />
))}
</CardContent>