Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix asset image loader positioning issue #1631

Merged
merged 8 commits into from
Feb 7, 2025
16 changes: 9 additions & 7 deletions app/components/assets/asset-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,32 @@ export const AssetImage = ({

return (
<>
<>
<div className={tw("relative overflow-hidden", className)}>
{isLoading && (
<div
className={tw(
"absolute inset-0 top-[6px] flex items-center justify-center bg-gray-100",
"transition-opacity", // Fallback animation
className
"absolute inset-0 flex items-center justify-center bg-gray-100",
"transition-opacity" // Fallback animation
)}
>
<Spinner className="[&_.spinner]:before:border-t-gray-400 " />
<Spinner className="[&_.spinner]:before:border-t-gray-400" />
</div>
)}

<img
onClick={withPreview ? handleOpenDialog : undefined}
src={url}
className={tw(withPreview && "cursor-pointer", className)}
className={tw(
"size-full object-cover",
withPreview && "cursor-pointer"
)}
alt={alt}
onLoad={handleImageLoad}
loading="lazy"
decoding="async"
{...rest}
/>
</>
</div>
{withPreview && (
<DialogPortal>
<Dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export function AdvancedIndexColumn({
modeIsAdvanced && freezeColumn ? freezeColumnClassNames.name : ""
)}
value={
<div className={tw("flex items-center gap-2 ")}>
<div className="flex items-center gap-2">
{showAssetImage ? (
<AssetImage
asset={{
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/assets._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ const ListAssetContent = ({ item }: { item: AssetsFromViewItem }) => {
to={`/assets/${item.id}`}
>
<div className="flex items-center gap-3">
<div className="relative flex size-12 shrink-0 items-center justify-center">
<div className="flex size-12 shrink-0 items-center justify-center">
<AssetImage
asset={{
assetId: item.id,
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_layout+/bookings.$bookingId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ export default function BookingEditPage() {
return shouldRenderOutlet ? (
<Outlet />
) : (
<>
<div className="relative">
<Header
title={hasName ? name : booking.name}
subHeading={
Expand All @@ -621,6 +621,6 @@ export default function BookingEditPage() {
<BookingPageContent />
<ContextualModal />
</div>
</>
</div>
);
}