refactor(project): load data from json
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
fd200b02fa
commit
9fe95cf36e
6 changed files with 79 additions and 38 deletions
|
@ -1,16 +1,28 @@
|
|||
<script>
|
||||
<script lang="ts">
|
||||
function json_to_project(json: any) {
|
||||
return {
|
||||
title: json.title,
|
||||
forge: json.forge,
|
||||
codeberg: json.codeberg,
|
||||
github: json.github,
|
||||
gitlab: json.gitlab
|
||||
};
|
||||
}
|
||||
|
||||
import Project from './project.svelte';
|
||||
import Bio from './bio.svelte';
|
||||
import LanguageStats from './languages.svelte';
|
||||
import ThemeToggle from './theme.svelte';
|
||||
import TiltCard from './tiltcard.svelte';
|
||||
|
||||
import * as light from './projects/light.json';
|
||||
import * as dazzle from './projects/dazzle.json';
|
||||
import * as bonfire from './projects/bonfire.json';
|
||||
import * as hikari from './projects/hikari.json';
|
||||
|
||||
import { Github, Gitlab, Code, GitBranch } from 'lucide-svelte';
|
||||
const repository = {
|
||||
label: 'Repository',
|
||||
url: 'https://git.light7734.com/light7734/light',
|
||||
iconComponent: GitBranch
|
||||
};
|
||||
const light_data = json_to_project(light);
|
||||
const dazzle_data = json_to_project(dazzle);
|
||||
const bonfire_data = json_to_project(bonfire);
|
||||
const hikari_data = json_to_project(hikari);
|
||||
|
||||
const mirrors = [
|
||||
{ label: 'Github', url: 'https://github.com/light7734/light', iconComponent: Github },
|
||||
|
@ -29,11 +41,6 @@
|
|||
|
||||
const features = ['MSAA', 'SSAO', 'PBR Lighting'];
|
||||
|
||||
const languages = [{ name: 'C++23', icon: 'cplusplus.svg' }, { name: 'CMake' }];
|
||||
|
||||
const graphicsApis = ['Vulkan', 'Metal', 'DirectX12'];
|
||||
|
||||
const cicd = ['Drone', 'Docker'];
|
||||
const lorem_ipsum =
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum';
|
||||
</script>
|
||||
|
@ -64,7 +71,7 @@
|
|||
headline="Dependency free, cross-platform and feature-rich 3D game engine."
|
||||
description={lorem_ipsum}
|
||||
icon="/light.svg"
|
||||
{repository}
|
||||
data={light_data}
|
||||
{mirrors}
|
||||
{gallery}
|
||||
{features}
|
||||
|
@ -76,7 +83,7 @@
|
|||
headline="Best way to learn is to teach, here be my articles."
|
||||
description={lorem_ipsum}
|
||||
icon="/signature.svg"
|
||||
{repository}
|
||||
data={dazzle_data}
|
||||
{mirrors}
|
||||
{gallery}
|
||||
{features}
|
||||
|
@ -88,7 +95,7 @@
|
|||
headline="You're enjoying its warmth on your eyes! :D"
|
||||
description={lorem_ipsum}
|
||||
icon="/signature.svg"
|
||||
{repository}
|
||||
data={bonfire_data}
|
||||
{mirrors}
|
||||
{gallery}
|
||||
{features}
|
||||
|
@ -100,7 +107,7 @@
|
|||
headline="Toy raytracer written in Rust using Vulkan"
|
||||
description={lorem_ipsum}
|
||||
icon="/hikari.svg"
|
||||
{repository}
|
||||
data={hikari_data}
|
||||
{mirrors}
|
||||
{gallery}
|
||||
{features}
|
||||
|
@ -123,13 +130,9 @@
|
|||
headline="C++ Engineer"
|
||||
description={lorem_ipsum}
|
||||
icon="/bitwyre-white.svg"
|
||||
{repository}
|
||||
{mirrors}
|
||||
{gallery}
|
||||
{features}
|
||||
{languages}
|
||||
{graphicsApis}
|
||||
{cicd}
|
||||
/>
|
||||
<br />
|
||||
|
||||
|
@ -138,13 +141,9 @@
|
|||
headline="C++ Engineer"
|
||||
description={lorem_ipsum}
|
||||
icon=""
|
||||
{repository}
|
||||
{mirrors}
|
||||
{gallery}
|
||||
{features}
|
||||
{languages}
|
||||
{graphicsApis}
|
||||
{cicd}
|
||||
/>
|
||||
<br />
|
||||
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
<script context="module">
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { ChevronDown, ChevronUp, ExternalLink, BookText } from 'lucide-svelte';
|
||||
|
||||
interface ProjectData {
|
||||
title: string | undefined;
|
||||
forge: string | undefined;
|
||||
codeberg: string | undefined;
|
||||
github: string | undefined;
|
||||
gitlab: string | undefined;
|
||||
}
|
||||
|
||||
import LanguageStats from './languages.svelte';
|
||||
import TiltCard from './tiltcard.svelte';
|
||||
|
||||
|
@ -17,6 +28,8 @@
|
|||
icon?: string;
|
||||
}
|
||||
|
||||
export let data: ProjectData = { title: '', forge: '', codeberg: '', github: '', gitlab: '' };
|
||||
|
||||
export let title: string;
|
||||
export let headline: string;
|
||||
export let description: string;
|
||||
|
@ -133,7 +146,6 @@
|
|||
<h4 class="mb-1 font-medium">{title}'s Tech Stack':</h4>
|
||||
|
||||
<!-- GALLERY -->
|
||||
|
||||
<h3 class="text-muted-foreground mb-3 text-sm font-semibold uppercase tracking-wide">
|
||||
Gallery
|
||||
</h3>
|
||||
|
@ -144,7 +156,7 @@
|
|||
</div>
|
||||
|
||||
<div class="mx-auto w-full py-4">
|
||||
<LanguageStats repositoryUrl="https://github.com/light7734/light" />
|
||||
<LanguageStats repositoryUrl={data.github ? data.github : ''} />
|
||||
</div>
|
||||
|
||||
<div class="flex items-start justify-start gap-0">
|
||||
|
@ -180,17 +192,15 @@
|
|||
Mirrors
|
||||
</h3>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
{#each mirrors as link}
|
||||
<a
|
||||
href={link.url}
|
||||
href={data.gitlab}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="text-accent-foreground flex items-center gap-1 transition-colors duration-200 hover:underline"
|
||||
>
|
||||
<svelte:component this={link.iconComponent} class="h-4 w-4" />
|
||||
{link.label}
|
||||
<Gitlab class="h-4 w-4" />
|
||||
"Gitlab"
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
9
src/routes/projects/bonfire.json
Normal file
9
src/routes/projects/bonfire.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"title": "Bonfire",
|
||||
"forge": "https://git.light7734.com/light7734/bonfire",
|
||||
"codeberg": "https://codeberg.org/light7734/bonfire",
|
||||
"github": "https://github.com/light7734/bonfire",
|
||||
"gitlab": "https://gitlab.com/light7734/bonfire"
|
||||
}
|
||||
|
||||
|
8
src/routes/projects/dazzle.json
Normal file
8
src/routes/projects/dazzle.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"title": "Dazzle",
|
||||
"forge": "https://git.light7734.com/light7734/dazzle",
|
||||
"codeberg": "https://codeberg.org/light7734/dazzle",
|
||||
"github": "https://github.com/light7734/dazzle",
|
||||
"gitlab": "https://gitlab.com/light7734/dazzle"
|
||||
}
|
||||
|
8
src/routes/projects/hikari.json
Normal file
8
src/routes/projects/hikari.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"title": "Hikari",
|
||||
"forge": "https://git.light7734.com/light7734/hikari",
|
||||
"codeberg": "https://codeberg.org/light7734/hikari",
|
||||
"github": "https://github.com/light7734/hikari",
|
||||
"gitlab": "https://gitlab.com/light7734/hikari"
|
||||
}
|
||||
|
7
src/routes/projects/light.json
Normal file
7
src/routes/projects/light.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"title": "Light",
|
||||
"forge": "https://git.light7734.com/light7734/light",
|
||||
"codeberg": "https://codeberg.org/light7734/light",
|
||||
"github": "https://github.com/light7734/light",
|
||||
"gitlab": "https://gitlab.com/light7734/light"
|
||||
}
|
Loading…
Add table
Reference in a new issue