Skip to content

Commit fafe95e

Browse files
committed
Adjusted card layout
1 parent 6ed2f93 commit fafe95e

File tree

2 files changed

+46
-32
lines changed

2 files changed

+46
-32
lines changed

app/page.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,19 @@ function getSkyboxSlugs(): string[] {
2727
mb-4
2828
"
2929
>
30-
<h1 className="text-2xl sm:text-4xl font-bold text-neutral-100 tracking-wide">
30+
<h1 className="text-2xl sm:text-4xl font-bold text-neutral-100 tracking-wide text-center text-nowrap">
3131
Jacob Robbins&rsquo; Skybox Textures
3232
</h1>
3333
</header>
3434

3535
<section
3636
className="
3737
grid gap-4
38-
grid-cols-[repeat(auto-fill,minmax(24rem,1fr))]
39-
px-4 sm:px-6 lg:px-8 /* side padding that expands with breakpoints */
38+
grid-cols-[repeat(auto-fill,minmax(16rem,1fr))]
39+
sm:grid-cols-[repeat(auto-fill,minmax(18rem,1fr))]
40+
lg:grid-cols-[repeat(auto-fill,minmax(22rem,1fr))]
41+
2xl:grid-cols-[repeat(auto-fill,minmax(26rem,1fr))]
42+
px-4 sm:px-6 lg:px-8
4043
"
4144
>
4245
{slugs.map((slug) => (

app/ui/skyboxcard.tsx

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,53 @@ type Props = {
99
const imgBase = `/Source_Skyboxes_NextJS/skyboxes/${slug}/images`;
1010
const details = `/${slug}`;
1111

12+
const thumbnail = `${imgBase}/thumbnail.webp`;
13+
1214
//placeholder
1315
const description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
1416

1517
return (
1618
<Link href={details}>
1719
<article
1820
className="
19-
flex flex-col items-center
20-
bg-neutral-800
21-
ring-1 ring-neutral-700/60
22-
shadow-lg shadow-black/40
23-
p-2
24-
m-0.5
25-
tranform hover:scale-105
26-
transition duration-150
27-
28-
">
29-
<div className='w-full text-center font-bold'>
30-
<h2 className="text-lg font-semibold text-left">{slug}</h2>
31-
</div>
32-
33-
<div className="relative w-full aspect-[16/9] overflow-hidden m-2">
34-
<Image
35-
src={`${imgBase}/thumbnail.webp`}
36-
alt={`${slug} preview`}
37-
fill
38-
sizes="(min-width:1280px) 16rem,
39-
(min-width:1024px) 22vw,
40-
(min-width:640px) 45vw,
41-
100vw"
42-
className="object-cover"
43-
unoptimized
44-
/>
45-
</div>
46-
<div className='w-full h-auto'>
47-
<h3 className="text-sm">{description}</h3>
21+
group
22+
relative flex flex-col items-center
23+
bg-neutral-800 ring-1 ring-neutral-700/60
24+
shadow-lg shadow-black/40
25+
transition duration-150 hover:scale-105
26+
overflow-hidden
27+
aspect-[16/9]
28+
"
29+
style={{
30+
backgroundImage: `url(${thumbnail})`,
31+
backgroundSize: 'cover',
32+
backgroundPosition: 'center',
33+
}}
34+
>
35+
36+
{/* Visually hidden image for SEO/alt text */}
37+
<Image
38+
src={thumbnail}
39+
alt={`${slug} preview`}
40+
fill
41+
className="opacity-0"
42+
unoptimized
43+
/>
44+
<div
45+
className="
46+
absolute inset-x-0 bottom-0
47+
translate-y-full
48+
group-hover:translate-y-0
49+
group-hover:opacity-100
50+
opacity-0
51+
bg-black/60
52+
px-3 py-2
53+
transition duration-150
54+
"
55+
>
56+
<h2 className="text-sm font-semibold text-neutral-100 truncate">
57+
{slug}
58+
</h2>
4859
</div>
4960
</article>
5061
</Link>

0 commit comments

Comments
 (0)