feat: improve uni-feed layout and styling consistency
- Adjusted highlight styles in the AllItem component to remove text color for better visual clarity. - Reduced the minimum height of media elements in AllItem for a more compact layout. - Updated the column width in AllMasonry for improved responsiveness and layout. - Simplified the class names in MasonryItemRender for cleaner code. These changes enhance the overall user interface by providing a more consistent and visually appealing layout across components.
This commit is contained in:
@@ -91,19 +91,19 @@ const highlightStyle = [
|
||||
// },
|
||||
{
|
||||
type: "full",
|
||||
className: "bg-blue-200 text-black",
|
||||
className: "bg-blue-200",
|
||||
},
|
||||
{
|
||||
type: "full",
|
||||
className: "bg-yellow-200 text-black",
|
||||
className: "bg-yellow-200",
|
||||
},
|
||||
{
|
||||
type: "full",
|
||||
className: "bg-green-200 text-black",
|
||||
className: "bg-green-200",
|
||||
},
|
||||
{
|
||||
type: "full",
|
||||
className: "bg-orange-200 text-black",
|
||||
className: "bg-orange-200",
|
||||
},
|
||||
]
|
||||
|
||||
@@ -328,13 +328,13 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation })
|
||||
src={mediaCover.url}
|
||||
type={mediaCover.type}
|
||||
previewImageUrl={mediaCover.preview_image_url}
|
||||
className="min-h-[10em] w-full overflow-hidden"
|
||||
mediaContainerClassName="size-full min-h-[10em] object-cover"
|
||||
videoClassName="size-full min-h-[10em] object-cover"
|
||||
className="min-h-[6em] w-full overflow-hidden"
|
||||
mediaContainerClassName="size-full min-h-[6em] object-cover"
|
||||
videoClassName="size-full min-h-[6em] object-cover"
|
||||
loading="lazy"
|
||||
proxy={{
|
||||
width: mediaCoverWidth ?? 200,
|
||||
height: mediaCoverHeight ?? 200,
|
||||
width: 600,
|
||||
height: 0,
|
||||
}}
|
||||
blurhash={mediaCover.blurhash || undefined}
|
||||
style={{
|
||||
@@ -342,7 +342,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation })
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex min-h-[10em] flex-col items-center justify-center overflow-hidden px-4 py-20 text-[1.5rem] font-normal leading-[1.2]">
|
||||
<div className="flex min-h-[6em] flex-col items-center justify-center overflow-hidden px-5 py-16 text-xl font-medium leading-snug text-black/80">
|
||||
<div className="line-clamp-6 max-w-full break-words">{titleWithKeyword}</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -364,7 +364,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation })
|
||||
onPreview={previewMedia}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex min-h-[10em] flex-col items-center justify-center overflow-hidden px-4 py-20 text-[1.5rem] font-normal leading-[1.2]">
|
||||
<div className="flex min-h-[6em] flex-col items-center justify-center overflow-hidden px-4 py-20 text-[1.5rem] font-normal leading-[1.2]">
|
||||
<div className="line-clamp-6 max-w-full break-words">{titleWithKeyword}</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -381,9 +381,9 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation })
|
||||
src={mediaCover.url}
|
||||
type={mediaCover.type}
|
||||
previewImageUrl={mediaCover.preview_image_url}
|
||||
className="min-h-[10em] w-full overflow-hidden"
|
||||
mediaContainerClassName="size-full min-h-[10em] object-cover"
|
||||
videoClassName="size-full min-h-[10em] object-cover"
|
||||
className="min-h-[6em] w-full overflow-hidden"
|
||||
mediaContainerClassName="size-full min-h-[6em] object-cover"
|
||||
videoClassName="size-full min-h-[6em] object-cover"
|
||||
loading="lazy"
|
||||
proxy={{
|
||||
width: mediaCover.width ?? 640,
|
||||
@@ -396,7 +396,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation })
|
||||
showFallback={true}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex min-h-[10em] flex-col items-center justify-center overflow-hidden px-4 py-20 text-[1.5rem] font-normal leading-[1.2]">
|
||||
<div className="flex min-h-[6em] flex-col items-center justify-center overflow-hidden px-4 py-20 text-[1.5rem] font-normal leading-[1.2]">
|
||||
<div className="line-clamp-6 max-w-full break-words">{titleWithKeyword}</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -404,7 +404,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation })
|
||||
<div className="pointer-events-none absolute inset-0">
|
||||
<ViewTag
|
||||
src={miniIframeSrc}
|
||||
className={cn("pointer-events-none size-full min-h-[10em] object-cover")}
|
||||
className={cn("pointer-events-none size-full min-h-[6em] object-cover")}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -26,7 +26,7 @@ interface AllMasonryProps {
|
||||
}
|
||||
|
||||
const GUTTER = 16
|
||||
const COLUMN_WIDTH = 250
|
||||
const COLUMN_WIDTH = 230
|
||||
const OVERSCAN = 2
|
||||
|
||||
interface MasonryItem {
|
||||
@@ -83,7 +83,7 @@ export const AllMasonry: FC<AllMasonryProps> = ({
|
||||
|
||||
const columnCount = useMemo(() => {
|
||||
if (!width) return 1
|
||||
return Math.max(1, Math.floor(width / COLUMN_WIDTH))
|
||||
return Math.max(1, Math.round(width / COLUMN_WIDTH))
|
||||
}, [width])
|
||||
|
||||
const columnWidth = useMemo(() => {
|
||||
@@ -268,10 +268,7 @@ const MasonryItemRender: React.ComponentType<RenderComponentProps<MasonryItem>>
|
||||
<div
|
||||
data-entry-id={data.entryId}
|
||||
data-index={index}
|
||||
className={clsx(
|
||||
"bg-background rounded-lg shadow-sm",
|
||||
"transition-all duration-200 hover:shadow-md",
|
||||
)}
|
||||
className={clsx("bg-background rounded-lg")}
|
||||
>
|
||||
<EntryItem entryId={data.entryId} view={FeedViewType.All} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user