Prepare basic components

This commit is contained in:
Kevin Kandlbinder 2024-11-12 14:57:16 +00:00
parent ae4334da41
commit 1160a04d23
12 changed files with 8504 additions and 8281 deletions

View file

@ -1,4 +1,10 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"hello_world": "Hello, {name} from de!"
"hello_world": "Hello, {name} from de!",
"body_part_throat": "Hals",
"body_part_thigh": "Oberschenkel",
"body_part_ankle": "Knöchel",
"body_part_upper_arm": "Oberarm",
"action_shock": "Shocken",
"action_vibrate": "Vibrieren"
}

View file

@ -1,4 +1,10 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"hello_world": "Hello, {name} from en!"
"hello_world": "Hello, {name} from en!",
"body_part_throat": "Throat",
"body_part_thigh": "Thigh",
"body_part_ankle": "Ankle",
"body_part_upper_arm": "Upper Arm",
"action_shock": "Shock",
"action_vibrate": "Vibrate"
}

42
package-lock.json generated
View file

@ -8,7 +8,9 @@
"name": "rtpunish-ui",
"version": "0.0.1",
"dependencies": {
"@inlang/paraglide-sveltekit": "^0.11.1"
"@fontsource-variable/roboto-flex": "^5.1.0",
"@inlang/paraglide-sveltekit": "^0.11.1",
"lucide-svelte": "^0.456.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^3.2.2",
@ -668,6 +670,12 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@fontsource-variable/roboto-flex": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@fontsource-variable/roboto-flex/-/roboto-flex-5.1.0.tgz",
"integrity": "sha512-TwH8+uOwBqIjxtvTc+kp7ywyH7V7bDLbAXrEQg2SoCTJ6m2pn00x7ULioTTzDEvek+XpbqIf8gbKE1zlcONNGg==",
"license": "OFL-1.1"
},
"node_modules/@humanfs/core": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
@ -5400,6 +5408,15 @@
"node": "18 >=18.20 || 20 || >=22"
}
},
"node_modules/lucide-svelte": {
"version": "0.456.0",
"resolved": "https://registry.npmjs.org/lucide-svelte/-/lucide-svelte-0.456.0.tgz",
"integrity": "sha512-SSdmxJOmL1h42ZypuGr54dYsXAT5o6WkQPKVDFnnrD0liOaXzfNNJuA7JbpkO9FFozBchyVpB1A1mKRmXOD8ug==",
"license": "ISC",
"peerDependencies": {
"svelte": "^3 || ^4 || ^5.0.0-next.42"
}
},
"node_modules/lz-string": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
@ -5460,6 +5477,19 @@
"node": ">=8.6"
}
},
"node_modules/micromatch/node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@ -5820,13 +5850,15 @@
"license": "ISC"
},
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz",
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">=8.6"
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"

View file

@ -68,6 +68,8 @@
"vitest": "^2.0.4"
},
"dependencies": {
"@inlang/paraglide-sveltekit": "^0.11.1"
"@fontsource-variable/roboto-flex": "^5.1.0",
"@inlang/paraglide-sveltekit": "^0.11.1",
"lucide-svelte": "^0.456.0"
}
}

48
src/app.css Normal file
View file

@ -0,0 +1,48 @@
:root {
--padding: 30px;
--gap: 20px;
--radius: 20px;
--width: 700px;
--layout-slant: -30deg;
--color-base: #fff;
--color-primary-100: #331400;
--color-primary-300: #cc5200;
--color-primary-500: #ff7e29;
--color-primary-700: #ffa061;
--color-primary-900: #ffc299;
--color-secondary-0: #040127;
--color-secondary-100: #060240;
--color-secondary-300: #0b046c;
--color-secondary-500: #170cb6;
--color-secondary-700: #4c40e7;
--color-secondary-900: #a8a4ea;
--color-accent: var(--color-primary-500);
--color-accent-contrast: #fff;
--color-border: rgba(0, 0, 0, .1);
--color-surface: #ececec;
--color-dark-surface: rgba(26, 37, 22, .9);
--color-dark-surface-text: white;
--color-dark-surface-text-dim: #808080;
--color-light-surface: rgba(255, 255, 255, .9);
--color-light-surface-text: var(--color-text);
--color-accent-surface: var(--color-accent);
--color-accent-surface-text: var(--color-accent-contrast);
--color-highlight-accent: rgba(255, 145, 49, .2);
--color-highlight-blue: rgba(10, 10, 255, .2);
--color-highlight-white: rgba(200, 200, 200, .2);
--color-highlight-grey: rgba(100, 100, 100, .2);
--color-highlight-yellow: rgba(255, 230, 10, .2);
--color-highlight-green: rgba(10, 255, 10, .2);
--color-highlight-red: rgba(255, 10, 10, .2);
--color-highlight-pink: rgba(255, 128, 255, .2);
--color-highlight-purple: rgba(204, 30, 152, .2);
--color-text: black;
--color-background: var(--color-base);
--nav-space: 95px;
--fill-pattern: repeating-linear-gradient( var(--layout-slant), var(--color-base) 0, var(--color-primary-500) .5px 3px, var(--color-base) 3.5px 12px );
--filter-gray: grayscale(1);
}
body {
font-family: 'Roboto Flex Variable', sans-serif;
}

View file

@ -0,0 +1,53 @@
<script lang="ts">
import type { Action } from "$lib/types";
import { Coins } from "lucide-svelte";
import * as m from '$lib/paraglide/messages.js';
export let action: Action;
const onclick = (ev: MouseEvent) => {
ev.preventDefault();
}
</script>
<button class="action-card" {onclick}>
<span class="body-part">{m[`body_part_${action.bodyPart}`]()}</span>
<span class="type">{m[`action_${action.type}`]()}</span>
<span class="cost"><Coins /> {action.cost} coins</span>
</button>
<style>
.action-card {
background-color: var(--color-base);
border: thin solid var(--color-border);
font: inherit;
cursor: pointer;
border-radius: var(--radius);
padding: var(--padding);
display: flex;
flex-direction: column;
align-items: flex-start;
.body-part {
opacity: .75;
}
.type {
font-size: 1.4em;
font-weight: 800;
color: var(--color-accent);
margin-bottom: 10px;
}
.cost {
display: flex;
justify-content: center;
gap: 5px;
opacity: .75;
> :global(svg) {
color: var(--color-accent);
}
}
}
</style>

View file

@ -0,0 +1,19 @@
<script lang="ts">
import type { Action } from "$lib/types";
import ActionCard from './ActionCard.svelte';
export let actions: Action[];
</script>
<div class="store-grid">
{#each actions as action}
<ActionCard {action} />
{/each}
</div>
<style>
.store-grid {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: var(--gap);
}
</style>

View file

@ -1 +1,3 @@
// Reexport your entry components here
export * from './types';

26
src/lib/types.ts Normal file
View file

@ -0,0 +1,26 @@
/**
* An action to execute.
*/
export type ActionType = "shock"|"vibrate";
/**
* A body part an action can affect.
*/
export type BodyPartKey = "throat"|"thigh"|"ankle"|"upper_arm";
/**
* Time in seconds or burst.
*/
export type Time = number|"burst";
/**
* Entry in the coinshop.
*/
export type Action = {
id: string;
subject: string;
type: ActionType;
cost: number;
bodyPart: BodyPartKey;
time: Time;
};

View file

@ -1,6 +1,10 @@
<script lang="ts">
import { i18n } from '$lib/i18n';
import { ParaglideJS } from '@inlang/paraglide-sveltekit';
import "../app.css";
import '@fontsource-variable/roboto-flex/full.css';
let { children } = $props();
</script>

View file

@ -1,3 +1,27 @@
<h1>Welcome to your library project</h1>
<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
<script lang="ts">
import StoreGrid from "$lib/components/StoreGrid.svelte";
import type { Action } from "$lib/types.js";
const exampleEntries: Action[] = [
{
id: "abcd",
type: "shock",
bodyPart: "thigh",
cost: 12,
subject: "raider",
time: "burst"
},
{
id: "efgh",
type: "shock",
bodyPart: "ankle",
cost: 8,
subject: "raider",
time: "burst"
}
]
</script>
<h1>Punish Raider</h1>
<StoreGrid actions={exampleEntries} />

View file

@ -12,7 +12,8 @@ const config = {
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter()
}
},
runes: true
};
export default config;