Added interfaces for potential typescript syntax

This commit is contained in:
Jonas_Jones 2023-10-01 22:22:53 +02:00
parent a91ff2fdb0
commit 819c89a09c
3 changed files with 74 additions and 9 deletions

View file

@ -1,9 +1,11 @@
<script>
export let project;
<script lang="ts">
//import type Project from "../scripts/interfaces";
export let project/*: Project*/;
import ProjectsLinks from "./ProjectsLinks.svelte";
import ProjectLanguageIndicator from "./ProjectLanguageIndicator.svelte";
import "../routes/+page.css";
</script>
<div class="top">
@ -21,11 +23,15 @@
<div class="project-topline">
<div class="project-title">{project.title}</div>
<div class="project-titleinfo">
<a
class="project-status"
style="color: {project.statuscolor};border-color:{project.statuscolor}"
>{project.status}</a
><a class="project-version">{project.version}</a>
<div>
<span
class="project-status"
style="color: {project.statuscolor};border-color:{project.statuscolor}"
>
{project.status}
</span>
<span class="project-version">{project.version}</span>
</div>
</div>
</div>
<div class="project-description">{project.description}</div>

View file

@ -1,5 +1,6 @@
<script>
export let project;
<script lang='ts'>
//import type Project from "../scripts/interfaces";
export let project/*: Project*/;
import { onMount } from "svelte";

58
src/scripts/interfaces.ts Normal file
View file

@ -0,0 +1,58 @@
export default interface Project {
title: string;
description: string;
status: string;
statuscolor: string;
categories: string[];
languages: { [key: string]: number };
gh_api: string;
version: string;
backgroud: string; // It seems there is a typo in the property name ("backgroud"), it should be corrected to "background" if intended.
links: {
GH: string;
WB: string;
MR: string;
};
visible: string;
last_update: string;
}
export default interface LanguageColors {
JavaScript: string;
HTML: string;
CSS: string;
Python: string;
Java: string;
'C++': string;
C: string;
Rust: string;
Svelte: string;
TypeScript: string;
Shell: string;
PHP: string;
Ruby: string;
Go: string;
Dart: string;
Kotlin: string;
Swift: string;
Scala: string;
'Objective-C': string;
Lua: string;
Perl: string;
CoffeeScript: string;
PowerShell: string;
Haskell: string;
Clojure: string;
TeX: string;
Elixir: string;
R: string;
'Vim script': string;
Assembly: string;
D: string;
OCaml: string;
'Emacs Lisp': string;
Crystal: string;
Vue: string;
Julia: string;
Nim: string;
}