This commit is contained in:
Yanick Champoux 2023-04-20 11:54:18 -04:00
parent 6990954e3b
commit a56fb3e769
9 changed files with 49 additions and 35 deletions

View File

@ -3,7 +3,7 @@
<input type="text" bind:value on:change /> <input type="text" bind:value on:change />
</slot> </slot>
{#if label} {#if label}
<label class:active={!!value}>{label}</label> <label class:active>{label}</label>
{/if} {/if}
</div> </div>
@ -13,6 +13,9 @@
export let placeholder = label; export let placeholder = label;
export let suffix = false; export let suffix = false;
export let activeLabel = undefined;
$: active = typeof activeLabel === "boolean" ? activeLabel : value;
</script> </script>
<style> <style>

View File

@ -11,7 +11,10 @@
/> />
</Field> </Field>
<label><input type="checkbox" bind:checked={advanced} /> advanced</label> <label class="checkbox">
<input type="checkbox" bind:checked={advanced} />
<span>advanced</span>
</label>
</div> </div>
</ShipItem> </ShipItem>
@ -36,4 +39,7 @@
display: flex; display: flex;
align-items: end; align-items: end;
} }
label {
margin-left: 2em;
}
</style> </style>

View File

@ -1,12 +1,13 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<Field label="FTL drive"> <div>FTL drive</div>
<nav>
{#each ftlTypes as t (t)} {#each ftlTypes as t (t)}
<label <label
><input type="radio" bind:group={type} value={t} /> ><input type="radio" bind:group={type} value={t} />
{t} <span>{t}</span>
</label> </label>
{/each} {/each}
</Field> </nav>
</ShipItem> </ShipItem>
<script lang="ts"> <script lang="ts">

View File

@ -33,5 +33,6 @@
div { div {
display: flex; display: flex;
gap: 2em; gap: 2em;
align-items: baseline;
} }
</style> </style>

View File

@ -1,20 +1,19 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<Field label="streamlining"> <div>streamlining</div>
<div> <div class="field middle-align">
<label> <label class="radio">
<input type="radio" bind:group={type} value="none" /> <input type="radio" bind:group={type} value="none" />
none</label <span>none</span></label
> >
<label> <label class="radio">
<input type="radio" bind:group={type} value="partial" /> <input type="radio" bind:group={type} value="partial" />
partial</label <span>partial</span></label
> >
<label> <label class="radio">
<input type="radio" bind:group={type} value="full" /> <input type="radio" bind:group={type} value="full" />
full</label <span>full</span></label
> >
</div> </div>
</Field>
</ShipItem> </ShipItem>
<script> <script>
@ -36,6 +35,6 @@
display: flex; display: flex;
} }
label { label {
margin-left: 1em; margin-left: 2em !important;
} }
</style> </style>

View File

@ -1,12 +1,13 @@
<div> <div>
<Field label=""> <button class="button small primary" on:click={addWeapon}>add weapon</button>
<Field label="" suffix>
<select bind:value={type}> <select bind:value={type}>
{#each weaponTypes as weapon (weapon.type)} {#each weaponTypes as weapon (weapon.type)}
<option value={weapon.type}>{weapon.name}</option> <option value={weapon.type}>{weapon.name}</option>
{/each} {/each}
</select> </select>
<i>arrow_drop_down</i>
</Field> </Field>
<button class="button small primary" on:click={addWeapon}>add weapon</button>
</div> </div>
<script> <script>
@ -30,6 +31,7 @@
button { button {
width: inherit; width: inherit;
display: inline-block; display: inline-block;
margin-right: 2em;
} }
div :global(.field) { div :global(.field) {
display: flex; display: flex;
@ -37,7 +39,8 @@
} }
div { div {
display: flex; display: flex;
margin-left: 5em; margin-left: 0em;
margin-bottom: 2em; margin-bottom: 2em;
align-items: baseline;
} }
</style> </style>

View File

@ -1,20 +1,22 @@
<label>beam</label> <span>beam</span>
<Field label="beam class"> <Field label="beam class" suffix>
<select bind:value={weaponClass}> <select bind:value={weaponClass}>
<option value={1}>1</option> <option value={1}>1</option>
<option value={2}>2</option> <option value={2}>2</option>
<option value={3}>3</option> <option value={3}>3</option>
<option value={4}>4</option> <option value={4}>4</option>
</select> </select>
<i>arrow_drop_down</i>
</Field> </Field>
<Field label="arcs"> <Field label="arcs" suffix>
<select bind:value={nbrArcs}> <select bind:value={nbrArcs}>
{#each arc_options[weaponClass] || [] as nbrArcs (nbrArcs)} {#each arc_options[weaponClass] || [] as nbrArcs (nbrArcs)}
<option>{nbrArcs}</option> <option>{nbrArcs}</option>
{/each} {/each}
</select> </select>
<i>arrow_drop_down</i>
</Field> </Field>
<Arcs selected={arcs} on:clickArc={({ detail }) => setArcs(detail)} /> <Arcs selected={arcs} on:clickArc={({ detail }) => setArcs(detail)} />

View File

@ -1,6 +1,6 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<div class="weapon_row"> <div class="weapon_row">
<button class="button small red remove" on:click={remove}>remove </button> <a on:click={remove}><i>Delete</i> </a>
<svelte:component this={component[type]} {...specs} on:change={update} /> <svelte:component this={component[type]} {...specs} on:change={update} />
</div> </div>

View File

@ -3,9 +3,12 @@
<div class="reqs"> <div class="reqs">
<div class="mass" bind:this={mass_el}> <div class="mass" bind:this={mass_el}>
{mass} <img src="{base}/mass.svg" alt="mass" /> {mass} <i>Weight</i>
</div>
<div class="cost" bind:this={cost_el}>
{cost}
<i>Paid</i>
</div> </div>
<div class="cost" bind:this={cost_el}>{cost}</div>
</div> </div>
</div> </div>
@ -53,10 +56,6 @@
img { img {
width: 0.75em; width: 0.75em;
} }
.cost:after {
content: "\00A4";
margin-left: 0.5em;
}
.mass img { .mass img {
width: 0.75em; width: 0.75em;
display: inline-block; display: inline-block;