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,14 +54,22 @@ 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 (
<Link href={`/portfolio/${props.image.id}`}>
<div <div
className={cn( className={cn(
"overflow-hidden", "overflow-hidden transition-all duration-100",
isSquare && "aspect-square shadow-sm hover:scale-[1.01] transition-transform", isSquare && "aspect-square shadow-sm hover:scale-[1.01] transition-transform",
isMosaic && "w-full h-full" isMosaic && "w-full h-full",
"hover:border-2 border-transparent"
)} )}
style={{ backgroundColor }} style={{
backgroundColor,
'--tw-border-opacity': 1,
'--hover-border-color': backgroundColor,
} as React.CSSProperties}
> >
<div <div
className={cn( className={cn(
@ -82,5 +91,6 @@ export function ImageCard(props: ImageCardProps) {
/> />
</div> </div>
</div> </div>
</Link>
); );
} }