aboutsummaryrefslogtreecommitdiff
path: root/src/pages/projects.astro
blob: 668217cd0ad159fb7d462a8b61ddce7fa95e740f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
import Page from "../layouts/Page.astro";
import projects from "../data/projects.json";
import "../styles/cards.css";

let repos;
let error = null;
try {
    const alee14_projects = await fetch('https://api.github.com/orgs/alee14-projects/repos');
    repos = await alee14_projects.json();
    repos = repos.filter(repo => !repo.fork);
} catch (err) {
    console.error('Failed to fetch projects:', err);
    error = err.message;
    // You can set repos to an empty array if the fetch fails
    repos = [];
}
---
<Page title="Projects" description="Things that I have been working on in the past, and present">
    <main>
        <div class="grid">
            {
                projects.map((project) => {
                    return (
                            <article class="card">
                                <h1>{project.name}</h1>
                                <p>{project.description}</p>
                                <div class="row">
                                    {project.links.map((link) => {
                                        return (
                                                <a href={link.url} target={link.external ? "_blank" : "_self"}>{link.name}</a>
                                        )
                                    })}
                                </div>
                            </article>
                    )
                })
            }
        </div>
        <h2>AleeCorp/Alee Productions GitHub Repositories</h2>
        { error && <div class="error">{error}</div> }
        <div class="grid">
            {repos.map((repo) => {
                return (
                        <article class="card">
                            <h1>{repo.name}</h1>
                            <p>{repo.description}</p>
                            <div class="row">
                                <a href={repo.html_url} target="_blank">Repository</a>
                            </div>
                        </article>
                )
            })}
        </div>
    </main>
</Page>
<style>
    .row {
        display: flex;
        flex-direction: row;
        gap: 1em;
    }
</style>