Skip to content

Commit 8b99770

Browse files
committed
fix images
1 parent b2ae3fa commit 8b99770

2 files changed

Lines changed: 27 additions & 20 deletions

File tree

app/projects/[slug]/_components/ProjectDetails.tsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ gsap.registerPlugin(useGSAP, ScrollTrigger);
1717

1818
const ProjectDetails = ({ project }: Props) => {
1919
const containerRef = useRef<HTMLDivElement>(null);
20+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? '';
2021

2122
useGSAP(
2223
() => {
@@ -179,26 +180,30 @@ const ProjectDetails = ({ project }: Props) => {
179180
className="fade-in-later relative flex flex-col gap-2 max-w-[800px] mx-auto"
180181
id="images"
181182
>
182-
{project.images.map((image) => (
183+
{project.images.map((image) => {
184+
const imageUrl = `${basePath}${image}`;
185+
186+
return (
183187
<div
184-
key={image}
185-
className="group relative w-full aspect-[750/400] bg-background-light"
186-
style={{
187-
backgroundImage: `url(${image})`,
188-
backgroundSize: 'contain',
189-
backgroundPosition: 'center 50%',
190-
backgroundRepeat: 'no-repeat',
191-
}}
192-
>
193-
<a
194-
href={image}
195-
target="_blank"
196-
className="absolute top-4 right-4 bg-background/70 text-foreground size-12 inline-flex justify-center items-center transition-all opacity-0 hover:bg-primary hover:text-primary-foreground group-hover:opacity-100"
188+
key={image}
189+
className="group relative w-full aspect-[750/400] bg-background-light"
190+
style={{
191+
backgroundImage: `url(${imageUrl})`,
192+
backgroundSize: 'contain',
193+
backgroundPosition: 'center 50%',
194+
backgroundRepeat: 'no-repeat',
195+
}}
197196
>
198-
<ExternalLink />
199-
</a>
200-
</div>
201-
))}
197+
<a
198+
href={imageUrl}
199+
target="_blank"
200+
className="absolute top-4 right-4 bg-background/70 text-foreground size-12 inline-flex justify-center items-center transition-all opacity-0 hover:bg-primary hover:text-primary-foreground group-hover:opacity-100"
201+
>
202+
<ExternalLink />
203+
</a>
204+
</div>
205+
);
206+
})}
202207
</div>
203208
</div>
204209
</section>

next.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
4-
/* config options here */
54
output: 'export',
65
basePath: '/Portfolio',
76
assetPrefix: '/Portfolio/',
87
trailingSlash: true,
9-
images: {
8+
env: {
9+
NEXT_PUBLIC_BASE_PATH: '/Portfolio',
10+
},
11+
images: {
1012
unoptimized: true,
1113
},
1214
};

0 commit comments

Comments
 (0)