chore: add chota css framework

Merge branch 'chota' into version-2
This commit is contained in:
Yanick Champoux 2022-03-20 17:40:26 -04:00
commit b07b769f27
16 changed files with 32 additions and 38 deletions

View File

@ -34,10 +34,12 @@
"@storybook/addon-svelte-csf": "^1.1.0", "@storybook/addon-svelte-csf": "^1.1.0",
"@storybook/svelte": "^6.4.19", "@storybook/svelte": "^6.4.19",
"@sveltejs/adapter-node": "^1.0.0-next.0", "@sveltejs/adapter-node": "^1.0.0-next.0",
"chota": "^0.8.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"redux": "^4.1.2", "redux": "^4.1.2",
"reselect": "^4.1.5", "reselect": "^4.1.5",
"rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-analyzer": "^4.0.0",
"svelte-chota": "^1.8.6",
"svelte-knobby": "^0.3.4", "svelte-knobby": "^0.3.4",
"ts-action": "^11.0.0", "ts-action": "^11.0.0",
"updux": "link:/home/yanick/work/javascript/updux-js/", "updux": "link:/home/yanick/work/javascript/updux-js/",

View File

@ -30,4 +30,7 @@ $: dispatch.setSquadronType({type, id});
</script> </script>
<style> <style>
select {
width: inherit;
}
</style> </style>

View File

@ -1,7 +1,7 @@
<Section label="carrier"> <Section label="carrier">
<ShipItem {...reqs}> <ShipItem {...reqs}>
<Field label="bays"> <Field label="bays">
<input type="number" min="0" bind:value={bays} /> <input class="short" type="number" min="0" bind:value={bays} />
</Field> </Field>
</ShipItem> </ShipItem>

View File

@ -1,7 +1,7 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<div> <div>
<Field label="thrust rating"> <Field label="thrust rating">
<input type="number" bind:value={rating} min="0" max="20" step="1" /> <input class="short" type="number" bind:value={rating} min="0" max="20" step="1" />
</Field> </Field>
<label><input type="checkbox" bind:checked={advanced} /> advanced</label> <label><input type="checkbox" bind:checked={advanced} /> advanced</label>

View File

@ -1,6 +1,6 @@
<div class="mass"> <div class="mass">
<Field label="ship tonnage"> <Field label="ship tonnage">
<input bind:value={mass} type="number" min="10" max="300" /> <input class="short" bind:value={mass} type="number" min="10" max="300" />
<span class="mass_symbol" /> <span class="mass_symbol" />
<div class="note" class:warning={!withinBudget}> <div class="note" class:warning={!withinBudget}>
@ -53,6 +53,7 @@
} }
input { input {
width: 5em; width: 5em;
display: inline !important;
} }
.mass_symbol:after { .mass_symbol:after {
content: url("/mass.svg"); content: url("/mass.svg");
@ -74,7 +75,7 @@
} }
.mass { .mass {
grid-column: 2; width: 15em;
} }
div.cost { div.cost {
grid-column: 3; grid-column: 3;

View File

@ -2,7 +2,7 @@
<div> <div>
<div class="nbr_layers"> <div class="nbr_layers">
<Field label="armour layers"> <Field label="armour layers">
<input type="number" min="0" bind:value={nbr_layers} /> <input class="short" type="number" min="0" bind:value={nbr_layers} />
</Field> </Field>
</div> </div>

View File

@ -1,5 +1,5 @@
<Field label={`layer ${layer}`}> <Field label={`layer ${layer}`}>
<input type="number" min="0" bind:value={rating} /> <input class="short" type="number" min="0" bind:value={rating} />
</Field> </Field>
<script> <script>

View File

@ -1,6 +1,6 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<Field label="cargo"> <Field label="cargo">
<input type="number" min="0" bind:value={space} /> <input class="short" type="number" min="0" bind:value={space} />
</Field> </Field>
</ShipItem> </ShipItem>

View File

@ -1,6 +1,6 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<Field label="hull"> <Field label="hull">
<input bind:value={rating} type="number" {min} {max} /> <input class="short" bind:value={rating} type="number" {min} {max} />
</Field> </Field>
</ShipItem> </ShipItem>

View File

@ -1,11 +1,11 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<div> <div>
<Field label="screens"> <Field label="screens">
<input type="number" bind:value={standard} min="0" /> <input class='short' type="number" bind:value={standard} min="0" />
</Field> </Field>
<Field label="advanced screens"> <Field label="advanced screens">
<input type="number" bind:value={advanced} min="0" /> <input class='short' type="number" bind:value={advanced} min="0" />
</Field> </Field>
</div> </div>
</ShipItem> </ShipItem>

View File

@ -5,7 +5,7 @@
{/each} {/each}
</select> </select>
<button class="button small blue" on:click={addWeapon} >add weapon</button> <button class="button small primary" on:click={addWeapon} >add weapon</button>
</Field> </Field>
<script> <script>
@ -20,3 +20,10 @@
const addWeapon = () => ship.dispatch.addWeapon(type); const addWeapon = () => ship.dispatch.addWeapon(type);
</script> </script>
<style>
select {
width: inherit;
display: inline-block;
}
</style>

View File

@ -53,7 +53,6 @@
function setArcs(firstArc) { function setArcs(firstArc) {
console.log(firstArc);
if (nbrArcs === "broadside") { if (nbrArcs === "broadside") {
arcs = broadside; arcs = broadside;
return; return;
@ -61,12 +60,10 @@
let first_index = all_arcs.findIndex((arc) => arc === firstArc); let first_index = all_arcs.findIndex((arc) => arc === firstArc);
if (first_index === -1) first_index = 0; if (first_index === -1) first_index = 0;
console.log({arcs, label:"before"}); arcs = Array.from({length: nbrArcs}).map(
arcs = _.range(nbrArcs).map( (_dummy,i) => all_arcs[(first_index + i) % all_arcs.length]
(i) => all_arcs[(first_index + i) % all_arcs.length]
); );
arcsCaches = arcs.join(','); arcsCaches = arcs.join(',');
console.log({arcs, label:"after"});
} }
$: if (arcs.length !== nbrArcs) setArcs(arcs[0]); $: if (arcs.length !== nbrArcs) setArcs(arcs[0]);

View File

@ -2,3 +2,7 @@
--main-font-family: "Dosis", -apple-system, BlinkMacSystemFont, "Segoe UI", --main-font-family: "Dosis", -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
} }
input.short {
width: 5em !important;
}

View File

@ -1,4 +1,5 @@
import "../../../static/fonts/faktos.css"; import "../../../static/fonts/faktos.css";
import "../../../static/fonts/dosis/dosis.css"; import "../../../static/fonts/dosis/dosis.css";
import "../../../static/global.css"; import "../../../static/global.css";
import 'chota';
import "./index.css"; import "./index.css";

View File

@ -3,10 +3,7 @@
<script> <script>
import { setContext } from "svelte"; import { setContext } from "svelte";
import '$lib/style/index.js';
import "../../static/fonts/faktos.css";
import "../../static/fonts/dosis/dosis.css";
import "../../static/global.css";
import shipStore from "$lib/store/ship.js"; import shipStore from "$lib/store/ship.js";
import App from "$lib/components/App.svelte"; import App from "$lib/components/App.svelte";

View File

@ -79,24 +79,6 @@ input[type="range"] {
height: 0; height: 0;
} }
button {
color: #333;
background-color: #f4f4f4;
outline: none;
}
button:disabled {
color: #999;
}
button:not(:disabled):active {
background-color: #ddd;
}
button:focus {
border-color: #666;
}
/* ---- inputs --- */ /* ---- inputs --- */
input, select { input, select {