Skip to content

Commit 2ec1f0c

Browse files
committed
Remove bg-image, consolidate components
1 parent 560e68c commit 2ec1f0c

12 files changed

+59
-43
lines changed

next.config.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
const nextConfig = {
33
output: "export",
44
reactStrictMode: true,
5-
// assetPrefix: "./"
5+
assetPrefix: "./",
6+
images: { unoptimized: true },
67
};
78

89
export default nextConfig;

public/img/avatar.jpg

-1.62 MB
Loading

public/img/avatar.jpg.old

546 KB
Binary file not shown.

public/img/banner.jpg

-10.6 MB
Binary file not shown.

src/app/components/artworkCard.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Image from "next/image";
2+
3+
export default function ArtworkCard({ href, imgSrc, title, description }) {
4+
return (
5+
<div className="relative">
6+
<a href={href} target="_blank">
7+
<Image src={imgSrc} alt="" width={400} height={400} className="block w-full h-auto" />
8+
<div className="absolute top-0 bottom-0 left-0 right-0 h-full w-full opacity-0 hover:opacity-100 transition duration-500 ease-in-out bg-gradient-to-t from-gray-900/50 to-gray-900/25 overflow-scroll">
9+
<div className="p-4 text-white">
10+
<div className="text-xl mb-4">
11+
{title}
12+
</div>
13+
<div>
14+
{description}
15+
</div>
16+
</div>
17+
</div>
18+
</a>
19+
</div>
20+
);
21+
};

src/app/components/banner.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import Image from "next/image";
2+
13
export default function Banner({ avatar, alt, title, subtitle }) {
24
return (
35
<div className="md:flex md:items-start md:gap-4 md:items-center md:justify-center">
4-
<img src={avatar} alt={alt} className="mx-auto md:mx-0 size-64 rounded-full object-cover" />
6+
<Image src={avatar} alt={alt} width={1024} height={1024} className="mx-auto md:mx-0 size-64 rounded-full object-cover" />
57
<div className="space-x-4">
68
<h1 className="text-center text-5xl md:text-7xl font-medium text-gray-900">{title}</h1>
79
<p className="text-center italic text-lg md:text-2xl text-gray-700">

src/app/components/footer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default function Footer() {
22
return (
3-
<div className="p-10 min-w-full text-center text-gray-100 bg-banner">
3+
<div className="p-10 min-w-full text-center text-gray-100">
44
&copy;2024 Ramon Meza
55
</div>
66
);

src/app/components/grid.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function Grid({ children }) {
2+
return (
3+
<div className="grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
4+
{children}
5+
</div>
6+
)
7+
};

src/app/components/repoCard.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function RepoCard({ href, title, description }) {
2+
return (
3+
<a href={href} className="group block rounded-lg p-6 bg-white ring-1 ring-slate-900/5 shadow-lg space-y-3 hover:bg-sky-500 hover:ring-sky-500" target="_blank">
4+
<div className="flex items-center">
5+
<h3 className="text-slate-900 group-hover:text-white text-sm font-semibold">{title}</h3>
6+
</div>
7+
<p className="text-slate-500 group-hover:text-white text-sm">{description}</p>
8+
</a>
9+
);
10+
};

src/app/components/respositories.js

-18
This file was deleted.

src/app/page.js

+15-21
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import React, { useEffect, useState } from "react";
44

55
// custom components
6+
import ArtworkCard from "./components/artworkCard";
67
import Banner from "./components/banner";
78
import Collapsible from "./components/collapsible";
89
import Error from "./components/error";
910
import Footer from "./components/footer";
11+
import Grid from "./components/grid";
1012
import Loading from "./components/loading";
11-
import Repositories from "./components/respositories";
13+
import RepoCard from "./components/repoCard";
1214
import RepoStats from "./components/repoStats";
1315

14-
15-
1616
// page
1717
export default function Page() {
1818
const [isLoading, setIsLoading] = useState(true);
@@ -57,21 +57,13 @@ export default function Page() {
5757

5858
const artworkCards = artwork.map((art) => {
5959
return (
60-
<div className="relative" key={art.id}>
61-
<a href={art.permalink} target="_blank">
62-
<img src={art.cover.thumb_url} alt="" className="block w-full h-auto" />
63-
<div className="absolute top-0 bottom-0 left-0 right-0 h-full w-full opacity-0 hover:opacity-100 transition duration-500 ease-in-out bg-gradient-to-t from-gray-900/50 to-gray-900/25 overflow-scroll">
64-
<div className="p-4 text-white">
65-
<div className="text-xl mb-4">
66-
{art.title}
67-
</div>
68-
<div>
69-
{art.description}
70-
</div>
71-
</div>
72-
</div>
73-
</a>
74-
</div>
60+
<ArtworkCard key={art.id} href={art.permalink} imgSrc={art.cover.thumb_url} title={art.title} description={art.description} />
61+
);
62+
});
63+
64+
const repoCards = repos.map((repo) => {
65+
return (
66+
<RepoCard key={repo.id} href={repo.html_url} title={repo.name} description={repo.description} />
7567
);
7668
});
7769

@@ -93,15 +85,17 @@ export default function Page() {
9385
</div>
9486
</Collapsible>
9587
<Collapsible open title="Artwork">
96-
<div className="grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
88+
<Grid>
9789
{artworkCards}
98-
</div>
90+
</Grid>
9991
</Collapsible>
10092
<Collapsible title="Repository Statistics">
10193
<RepoStats bytesOfCode={bytesOfCode} repos={repos} />
10294
</Collapsible>
10395
<Collapsible title="All Repositories">
104-
<Repositories repos={repos} />
96+
<Grid>
97+
{repoCards}
98+
</Grid>
10599
</Collapsible>
106100
</div>
107101
</main>

tailwind.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module.exports = {
1212
'height': 'height',
1313
},
1414
backgroundImage: {
15-
"banner": "url('../../public/img/banner.jpg')",
1615
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
1716
"gradient-conic":
1817
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",

0 commit comments

Comments
 (0)