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

38 lines
895 B
Svelte
Raw Normal View History

2022-03-01 17:42:33 +00:00
<ShipItem {cost} {mass}>
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-01 17:42:33 +00:00
import dux from "$lib/dux/carrier";
import squadron_types from "$lib/dux/carrier/squadron_types";
2020-07-27 17:42:19 +00:00
2022-03-01 17:42:33 +00:00
const types = squadron_types.map(({ type }) => type);
2020-07-27 17:42:19 +00:00
export let id = 1;
export let type = "standard";
2021-06-13 15:36:59 +00:00
export let ftl = false;
2022-03-01 17:42:33 +00:00
export let cost = 0;
2020-07-27 17:42:19 +00:00
export let mass = 0;
2022-03-01 17:42:33 +00:00
export let ship = getContext("ship");
2020-07-27 17:42:19 +00:00
2022-03-01 17:42:33 +00:00
$: ship?.dispatch_action("set_squadron", { id, type });
2020-07-27 17:42:19 +00:00
</script>
<style>
2022-03-01 17:42:33 +00:00
div {
background-color: red;
}
2020-07-27 17:42:19 +00:00
</style>