very early frontend wip + small fixes.

This commit is contained in:
2023-01-13 17:24:13 +01:00
parent 842f96d8e3
commit e831c0f342
20 changed files with 5132 additions and 7 deletions
+9
View File
@@ -0,0 +1,9 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
<style>
body, html {
background: #111114;
color: #ccc;
margin: 0;
padding: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
</style>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
+76
View File
@@ -0,0 +1,76 @@
<script lang="ts">
import type { ColorRGB } from "../models/color";
export let selected: boolean = false;
export let title: string;
export let color: ColorRGB;
export let intensity: number;
let displayTitle: string;
$: {
if (title.length > 12) {
let last = title.split(" ").pop() || title;
if (last.length > 4) {
last = last.slice(-3);
}
displayTitle = `${(title.split(" ").shift()||"").slice(0, 10 - last.length)}... ${last}`
} else {
displayTitle = title;
}
}
</script>
<div class="lamp" class:selected>
<div class="row">
<div style="background-color: rgb({color.red*255},{color.green*255},{color.blue*255})" class="roundboi"></div>
<div class="title">{displayTitle}</div>
</div>
<div class="flatboi">
<div style="width: {intensity*100}%; background-color: rgb({color.red*255},{color.green*255},{color.blue*255})" class="flatboi2"></div>
</div>
</div>
<style>
div.lamp {
width: 15ch;
height: 2em;
margin: 0.25em;
background: #18181c;
color: #84888f;
border-radius: 0.25em;
border-top-right-radius: 1em;
overflow: hidden;
}
div.lamp.selected {
background: #282833;
color: #cde;
}
div.lamp > div.row {
display: flex;
}
div.lamp > div.row > div.roundboi {
width: 1.25em;
height: 1.25em;
margin-left: 0.25em;
margin-top: 0.30em;
border-radius: 2em;
box-sizing: border-box;
border: 0.5px solid #000;
}
div.lamp > div.row > div.title {
font-size: 0.9em;
text-align: left;
margin-top: 0.4em;
margin-left: 0.75ch;
margin-right: 1ch;
height: 1.6em;
}
div.lamp > div.flatboi {
height: 0.2em;
background-color: #040408;
}
div.lamp > div.flatboi > div.flatboi2 {
height: 0.2em;
}
</style>
+9
View File
@@ -0,0 +1,9 @@
export interface ColorRGB {
red: number
green: number
blue: number
}
export function rgb(red: number, green: number, blue: number): ColorRGB {
return {red, green, blue};
}
+32
View File
@@ -0,0 +1,32 @@
<script lang="ts">
import Lamp from "$lib/components/Lamp.svelte";
import { rgb } from "$lib/models/color";
</script>
<div class="page">
<Lamp title="Hexagon 1" color={rgb(1.000,0.541,0.071)} intensity={0.3} />
<Lamp title="Hexagon 2" color={rgb(1.000,0.541,0.071)} intensity={0.4} />
<Lamp title="Hexagon 3" color={rgb(1.000,0.541,0.071)} intensity={0.5} />
<Lamp title="Hexagon 4" color={rgb(1.000,0.631,0.282)} selected intensity={0.1} />
<Lamp title="Lamp with an equally absurd name" color={rgb(0.500,0.542,1.000)} selected intensity={0.3} />
<Lamp title="Hexagon 5" color={rgb(1.000,0.631,0.282)} selected intensity={0.66} />
<Lamp title="Hexagon 6" color={rgb(1.000,0.700,0.408)} selected intensity={0.92} />
<Lamp title="Hexagon 7" color={rgb(1.000,0.700,0.408)} intensity={1} />
<Lamp title="Hexagon 8" color={rgb(1.000,0.700,0.408)} intensity={0.9} />
<Lamp title="Hexagon 9" color={rgb(1.000,0.700,0.408)} intensity={0.5} />
<Lamp title="Signe Table Lamp 1" color={rgb(0.765,0.820,1.000)} selected intensity={0.79} />
</div>
<style>
div.page {
margin: 0 auto;
width: 100ch;
max-width: 95%;
margin-top: 1em;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
</style>