Remove render functions

This commit is contained in:
Sam Becker 2025-03-14 23:18:55 -05:00
parent b13b286b3f
commit 7127bdf354

View File

@ -149,22 +149,21 @@ export default function PhotoLarge({
hasTitleContent || hasTitleContent ||
hasMetaContent; hasMetaContent;
const renderPhotoLink = () => const renderPhotoLink =
<PhotoLink <PhotoLink
photo={photo} photo={photo}
className="font-bold uppercase grow" className="font-bold uppercase grow"
prefetch={prefetch} prefetch={prefetch}
/>; />;
const matteContentWidthForAspectRatio = () => { // Restrict width for landscape photos
// Restrict width for landscape photos // (portrait photos are always height restricted)
// (portrait photos are always height restricted) const matteContentWidthForAspectRatio =
if (photo.aspectRatio > 3 / 2 + 0.1) { photo.aspectRatio > 3 / 2 + 0.1
return 'w-[90%]'; ? 'w-[90%]'
} else if (photo.aspectRatio >= 1) { : photo.aspectRatio >= 1
return 'w-[80%]'; ? 'w-[80%]'
} : undefined;
};
const largePhotoContent = const largePhotoContent =
<div className={clsx( <div className={clsx(
@ -172,7 +171,7 @@ export default function PhotoLarge({
arePhotosMatted && 'flex items-center justify-center', arePhotosMatted && 'flex items-center justify-center',
// Always specify height to ensure fallback doesn't collapse // Always specify height to ensure fallback doesn't collapse
arePhotosMatted && 'h-[90%]', arePhotosMatted && 'h-[90%]',
arePhotosMatted && matteContentWidthForAspectRatio(), arePhotosMatted && matteContentWidthForAspectRatio,
)}> )}>
<ZoomControls <ZoomControls
ref={zoomControlsRef} ref={zoomControlsRef}
@ -257,8 +256,8 @@ export default function PhotoLarge({
<div className="pr-2 md:pr-0"> <div className="pr-2 md:pr-0">
<div className="md:relative flex gap-2 items-start"> <div className="md:relative flex gap-2 items-start">
{hasTitle && (showTitleAsH1 {hasTitle && (showTitleAsH1
? <h1>{renderPhotoLink()}</h1> ? <h1>{renderPhotoLink}</h1>
: renderPhotoLink())} : renderPhotoLink)}
<div className="absolute right-0 translate-y-[-4px] z-10"> <div className="absolute right-0 translate-y-[-4px] z-10">
<AdminPhotoMenuClient {...{ <AdminPhotoMenuClient {...{
photo, photo,