fix: cls when star in gird item (#636)

* fix: grid item UI

The star icon causes layout shift, and the original line height settings may lead to the title being truncated

* fix: cls

Signed-off-by: Innei <i@innei.in>

* fix: hono

Signed-off-by: Innei <i@innei.in>

---------

Signed-off-by: Innei <i@innei.in>
Co-authored-by: Innei <i@innei.in>
This commit is contained in:
legao 2024-09-26 06:53:52 +00:00 committed by GitHub
parent 419c9cfd51
commit b993ae050e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 16 deletions

View File

@ -59,7 +59,7 @@ export function SwipeMedia({
<div
ref={hoverRef}
className={cn(
"relative flex w-full items-center overflow-hidden ",
"relative flex w-full items-center overflow-hidden",
styles["swipe-wrapper"],
className,
)}

View File

@ -108,6 +108,7 @@ export const useUnread = () =>
export const useEntryActions = ({
view,
entry,
type,
}: {
view?: number
entry?: FlatEntryModel | null
@ -300,12 +301,14 @@ export const useEntryActions = ({
className: "i-mgc-star-cute-re",
hide: !!populatedEntry.collections,
onClick: (e) => {
mountLottie(absoluteStarAnimationUri, {
x: e.clientX - 90,
y: e.clientY - 70,
height: 126,
width: 252,
})
if (type === "toolbar") {
mountLottie(absoluteStarAnimationUri, {
x: e.clientX - 90,
y: e.clientY - 70,
height: 126,
width: 252,
})
}
collect.mutate()
},

View File

@ -105,7 +105,7 @@ export const PictureWaterFallItem = memo(function PictureWaterFallItem({
<EntryItemWrapper
view={FeedViewType.Pictures}
entry={entry}
itemClassName="group hover:bg-theme-item-hover rounded-md"
itemClassName="group hover:bg-theme-item-hover rounded-md overflow-hidden"
style={{
width: itemWidth,
}}

View File

@ -1,7 +1,5 @@
import { cn } from "~/lib/utils"
export const StarIcon: Component = ({ className }) => (
<i
className={cn("i-mgc-star-cute-fi absolute right-0 top-0 text-base text-orange-400", className)}
/>
<i className={cn("i-mgc-star-cute-fi text-base text-orange-400", className)} />
)

View File

@ -61,15 +61,18 @@ export const GridItemFooter = ({
/>
<div
className={cn(
"relative mb-1 mt-1.5 flex w-full items-center gap-1 truncate font-medium leading-none",
!!entry.collections && "pr-5",
"relative mb-1 mt-1.5 flex w-full items-center gap-1 truncate font-medium",
titleClassName,
)}
>
<TitleMarquee className="min-w-0 grow">
<EntryTranslation source={entry.entries.title} target={translation?.title} />
</TitleMarquee>
{!!entry.collections && <StarIcon className="static shrink-0 self-end" />}
{!!entry.collections && (
<div className="h-0 shrink-0 -translate-y-2">
<StarIcon />
</div>
)}
</div>
</div>
<div className="flex items-center gap-1 truncate text-[13px]">

View File

@ -547,7 +547,7 @@ declare const collections: drizzle_orm_pg_core.PgTableWithColumns<{
generated: undefined;
}, {}, {}>;
feedId: drizzle_orm_pg_core.PgColumn<{
name: "feedId";
name: "feed_id";
tableName: "collections";
dataType: "string";
columnType: "PgText";
@ -3426,6 +3426,8 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
handle: string | null;
createdAt: string;
} | null | undefined;
subscriptionCount?: number | undefined;
purchaseAmount?: number | undefined;
}[];
};
outputFormat: "json" | "text";
@ -3696,7 +3698,6 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
userId: string;
view: number;
category: string | null;
feedId: string;
feeds: {
type: "feed";
id: string;
@ -3725,6 +3726,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
createdAt: string;
}[] | null | undefined;
};
feedId: string;
isPrivate: boolean;
} | {
title: string | null;