Add border to variant two

This commit is contained in:
2025-07-13 00:45:35 +02:00
parent 297848a83a
commit 08635dc0d5
3 changed files with 36 additions and 22 deletions

View File

@ -20,7 +20,7 @@ export async function getJustifiedImages() {
const variant = img.variants.find((v) => v.type === "resized"); const variant = img.variants.find((v) => v.type === "resized");
if (!variant || !variant.width || !variant.height) return null; if (!variant || !variant.width || !variant.height) return null;
const bg = img.colors.find((c) => c.type === "vibrant")?.color.hex ?? "#e5e7eb"; const bg = img.colors.find((c) => c.type === "Vibrant")?.color.hex ?? "#e5e7eb";
return { return {
id: img.id, id: img.id,

View File

@ -172,6 +172,10 @@
@apply line-through text-muted-foreground; @apply line-through text-muted-foreground;
} }
div:hover {
border-color: var(--hover-border-color);
}
@layer base { @layer base {
* { * {
@apply border-border outline-ring/50; @apply border-border outline-ring/50;

View File

@ -3,6 +3,7 @@
import type { Color, ImageColor, ImageVariant, PortfolioImage } from "@/generated/prisma"; import type { Color, ImageColor, ImageVariant, PortfolioImage } from "@/generated/prisma";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link";
// ---------- Type Definitions ---------- // ---------- Type Definitions ----------
@ -53,34 +54,43 @@ export function ImageCard(props: ImageCardProps) {
? `/api/image/thumbnail/${props.image.fileKey}.webp` ? `/api/image/thumbnail/${props.image.fileKey}.webp`
: props.image.url; : props.image.url;
console.log(props.image);
return ( return (
<div <Link href={`/portfolio/${props.image.id}`}>
className={cn(
"overflow-hidden",
isSquare && "aspect-square shadow-sm hover:scale-[1.01] transition-transform",
isMosaic && "w-full h-full"
)}
style={{ backgroundColor }}
>
<div <div
className={cn( className={cn(
"relative w-full h-full", "overflow-hidden transition-all duration-100",
isSquare && "flex items-center justify-center" isSquare && "aspect-square shadow-sm hover:scale-[1.01] transition-transform",
isMosaic && "w-full h-full",
"hover:border-2 border-transparent"
)} )}
style={{
backgroundColor,
'--tw-border-opacity': 1,
'--hover-border-color': backgroundColor,
} as React.CSSProperties}
> >
<Image <div
src={src}
alt={altText}
fill={isMosaic}
width={isSquare ? 400 : undefined}
height={isSquare ? 400 : undefined}
className={cn( className={cn(
isSquare && "object-contain max-w-full max-h-full", "relative w-full h-full",
isMosaic && "object-cover" isSquare && "flex items-center justify-center"
)} )}
loading="lazy" >
/> <Image
src={src}
alt={altText}
fill={isMosaic}
width={isSquare ? 400 : undefined}
height={isSquare ? 400 : undefined}
className={cn(
isSquare && "object-contain max-w-full max-h-full",
isMosaic && "object-cover"
)}
loading="lazy"
/>
</div>
</div> </div>
</div> </Link>
); );
} }