Skip to content

Commit d71b14c

Browse files
committed
feat: add projects page
1 parent 4046b1b commit d71b14c

15 files changed

+151
-4
lines changed

bun.lockb

4.3 KB
Binary file not shown.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@ark-ui/solid": "^4.10.0",
1616
"@astrojs/solid-js": "^5.0.4",
1717
"@fontsource-variable/jetbrains-mono": "^5.1.2",
18+
"@octokit/core": "^6.1.3",
1819
"astro": "^5.1.8",
1920
"astro-og-canvas": "^0.5.6",
2021
"graphql-request": "^7.1.2",

src/components/MDContainer.astro

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const { class: className } = Astro.props;
2323
>
2424
<main class={css({ maxWidth: "prose" })}>
2525
<slot />
26+
<br />
2627
</main>
2728
</Box>
2829
</Container>

src/components/Navbar.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const Navbar: Component = () => {
4040
<TablerHomeFilled />
4141
</NavItem>
4242
<HStack gap="4">
43+
<a href="/projects">Projects</a>
4344
<a href="/blog">Blog</a>
4445
<Divider orientation="vertical" thickness="2" height="1em" />
4546
<NavItem

src/components/ProjectCard.astro

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
import type { CollectionEntry } from "astro:content";
3+
import { render } from "astro:content";
4+
import { Grid } from "styled-system/jsx";
5+
import { octokit } from "~/content/projects/client";
6+
import { Card } from "./ui/Card";
7+
8+
interface Props {
9+
project: CollectionEntry<"projects">;
10+
}
11+
12+
const { project } = Astro.props;
13+
const [owner, repoName] = project.data.repo.split("/");
14+
const { data: repository } = await octokit.request(
15+
"GET /repos/{owner}/{repo}",
16+
{
17+
owner,
18+
repo: repoName,
19+
},
20+
);
21+
22+
const homepage = repository.homepage || project.data.homepage;
23+
24+
const { Content } = await render(project);
25+
---
26+
27+
<h2>{project.data.name}</h2>
28+
<Grid columns={{ base: 1, sm: 2 }}>
29+
<Card title="Description">
30+
<Content />
31+
</Card>
32+
<Card title="Details">
33+
<p>
34+
<b>GitHub: </b>
35+
<a href={`https://github.com/${project.data.repo}`} target="_blank">
36+
{project.data.repo}
37+
</a>
38+
</p>
39+
{
40+
homepage && (
41+
<p>
42+
<b>Homepage: </b>
43+
<a href={homepage} target="_blank">
44+
{homepage}
45+
</a>
46+
</p>
47+
)
48+
}
49+
</Card>
50+
</Grid>

src/components/ui/Card.tsx

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import type { ParentComponent } from "solid-js";
2+
import { css } from "styled-system/css";
3+
import { Box, HStack } from "styled-system/jsx";
4+
5+
export const Card: ParentComponent<{ title: string }> = (props) => {
6+
const HorizontalLine = (
7+
<Box
8+
borderTopWidth="normal"
9+
borderLeftWidth="normal"
10+
borderStyle="solid"
11+
flexGrow="1"
12+
aria-hidden="true"
13+
/>
14+
);
15+
16+
return (
17+
<Box>
18+
<HStack alignItems="end">
19+
{HorizontalLine}
20+
<span class={css({ marginBottom: "-0.5em" })}>{props.title}</span>
21+
{HorizontalLine}
22+
</HStack>
23+
<Box
24+
borderStyle="solid"
25+
borderLeftWidth="normal"
26+
borderRightWidth="normal"
27+
borderBottomWidth="normal"
28+
p="4"
29+
>
30+
{props.children}
31+
</Box>
32+
</Box>
33+
);
34+
};

src/content.config.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,13 @@ const blog = defineCollection({
1313
loader: hashnodeLoader(),
1414
});
1515

16-
export const collections = { pages, blog };
16+
const projects = defineCollection({
17+
loader: glob({ pattern: "**/[^_]*.md", base: "./src/content/projects" }),
18+
schema: z.object({
19+
name: z.string(),
20+
repo: z.string(),
21+
homepage: z.string().optional(),
22+
}),
23+
});
24+
25+
export const collections = { pages, blog, projects };

src/content/pages/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,3 @@ Today I enjoy developing applications and finding optimized solutions to complex
1919
## Contact Me
2020

2121
Feel free to email me at [[email protected]](mailto:[email protected])
22-
23-
-----

src/content/projects/client.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Octokit } from "@octokit/core";
2+
3+
export const octokit = new Octokit();

src/content/projects/demochain.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: Demochain
3+
repo: thecomputerm/demochain
4+
---
5+
6+
A dummy peer-2-peer **blockchain** network that can run purely in your **browser** using WebRTC *without* a central server.

src/content/projects/ffigenpad.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: FFIgenPad
3+
repo: thecomputerm/ffigenpad
4+
homepage: https://ffigenpad.surge.sh
5+
---
6+
7+
My [GSoC](https://summerofcode.withgoogle.com/archive/2024/projects/NDTqal0i) project with the [Dart](https://dart.dev/) organization. Use your C headers to generate *dart:ffi* bindings fully in the browser using **WASM**.

src/content/projects/lex.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: Lex
3+
repo: crux-bphc/lex
4+
---
5+
6+
A flutter app with a companion [golang server](https://github.com/crux-bphc/lex-backend) that enables the students of BITS Hyderabad to be more academically productive.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: Svelte Materialify
3+
repo: thecomputerm/svelte-materialify
4+
---
5+
6+
**DEPRECATED**, my **first** huge open-source project, a *material design* component library for **Svelte** 3.

src/layouts/app.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
color: var(--colors-bg-canvas);
8282
}
8383

84-
p {
84+
p:not(:last-child) {
8585
margin-bottom: var(--line-heights-normal);
8686
}
8787

src/pages/projects.astro

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
import { getCollection } from "astro:content";
3+
import { css } from "styled-system/css";
4+
import MDContainer from "~/components/MDContainer.astro";
5+
import ProjectCard from "~/components/ProjectCard.astro";
6+
import BaseLayout from "~/layouts/BaseLayout.astro";
7+
8+
const projects = await getCollection("projects");
9+
---
10+
11+
<BaseLayout title="Projects | TheComputerM">
12+
<MDContainer>
13+
<h1 class={css({ marginBottom: "2" })}>Projects</h1>
14+
<p class={css({ color: "fg.canvas" })}>
15+
Some of my most cherished and meticulously developed projects.
16+
</p>
17+
<hr />
18+
{projects.map((project) => <ProjectCard project={project} />)}
19+
<hr />
20+
<p>
21+
See more of my work and other open-source contributions over on my
22+
<a href="https://github.com/TheComputerM" target="_blank">GitHub</a>.
23+
</p>
24+
</MDContainer>
25+
</BaseLayout>

0 commit comments

Comments
 (0)