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

36 lines
814 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";
2023-03-03 23:02:52 +00:00
import { squadronTypes } from "$lib/shipDux/carrier";
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;
2023-03-03 23:02:52 +00:00
export let reqs = {};
2020-07-27 17:42:19 +00:00
2022-03-05 18:41:30 +00:00
export let { dispatch } = getContext("ship");
2023-03-03 23:02:52 +00:00
$: console.log(type);
$: dispatch.setSquadronType({ type, id });
2020-07-27 17:42:19 +00:00
</script>
<style>
2023-03-03 23:02:52 +00:00
select {
2022-03-20 18:42:59 +00:00
width: inherit;
2023-03-03 23:02:52 +00:00
}
2020-07-27 17:42:19 +00:00
</style>