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

41 lines
925 B
Svelte
Raw Normal View History

2022-03-05 18:41:30 +00:00
<ShipItem {...reqs}>
2023-04-22 14:37:49 +00:00
<div class="field label suffix">
2020-07-27 17:42:19 +00:00
<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>
2023-04-22 14:37:49 +00:00
<label class="active">squadron {id}</label>
<i>arrow_drop_down</i>
</div></ShipItem
>
2020-07-27 17:42:19 +00:00
<script>
2022-03-01 17:42:33 +00:00
import { getContext } from "svelte";
2020-07-27 17:42:19 +00:00
2023-03-21 17:57:43 +00:00
import Section from "$lib/components/Section.svelte";
import Field from "$lib/components/Field.svelte";
import ShipItem from "$lib/components/ShipItem.svelte";
2023-04-22 14:37:49 +00:00
import { squadronTypes } from "$lib/store/ship/carrier.ts";
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;
2023-03-21 17:57:43 +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
2023-03-21 17:57:43 +00:00
export let { dispatch } = getContext("api");
2022-03-05 18:41:30 +00:00
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 {
2023-04-22 14:37:49 +00:00
/* width: inherit; */
}
div {
display: inline-block;
2023-03-03 23:02:52 +00:00
}
2020-07-27 17:42:19 +00:00
</style>