aotds-docks/src/lib/components/ShipEdit/Carrier/Squadron.svelte

37 lines
808 B
Svelte
Raw Normal View History

2022-03-05 18:41:30 +00:00
<ShipItem {...reqs}>
2020-07-27 17:42:19 +00:00
<Field label={`squadron ${id}`}>
<select bind:value={type}>
{#each types as type (type)}
2021-06-13 15:36:59 +00:00
<option>{type}</option>
2020-07-27 17:42:19 +00:00
{/each}
</select>
</Field>
</ShipItem>
<script>
2022-03-01 17:42:33 +00:00
import { getContext } from "svelte";
2020-07-27 17:42:19 +00:00
2021-05-17 13:48:31 +00:00
import Section from "$lib/components/Section/index.svelte";
import Field from "$lib/components/Field/index.svelte";
import ShipItem from "$lib/components/ShipItem/index.svelte";
2022-03-05 18:41:30 +00:00
import { squadronTypes } from "$lib/shipDux/carrier.js";
2020-07-27 17:42:19 +00:00
2022-03-05 18:41:30 +00:00
const types = squadronTypes.map(({ type }) => type);
2020-07-27 17:42:19 +00:00
export let id = 1;
2022-03-05 18:41:30 +00:00
export let type = types[0].type;
export let reqs= {};
2020-07-27 17:42:19 +00:00
2022-03-05 18:41:30 +00:00
export let { dispatch } = getContext("ship");
$: console.log(type)
$: dispatch.setSquadronType({type, id});
2020-07-27 17:42:19 +00:00
</script>
<style>
2022-03-20 18:42:59 +00:00
select {
width: inherit;
}
2020-07-27 17:42:19 +00:00
</style>