aotds-docks/src/lib/components/Engine/index.svelte

40 lines
855 B
Svelte
Raw Normal View History

2022-03-01 17:42:33 +00:00
<ShipItem {...reqs}>
<div>
<Field label="thrust rating">
<input type="number" bind:value={rating} min="0" max="20" step="1" />
</Field>
<label><input type="checkbox" bind:checked={advanced} /> advanced</label>
</div>
2020-07-19 20:21:28 +00:00
</ShipItem>
<script>
2022-03-01 17:42:33 +00:00
import { getContext } from "svelte";
import Field from "$lib/components/Field/index.svelte";
import ShipItem from "$lib/components/ShipItem/index.svelte";
2020-07-19 20:21:28 +00:00
2022-03-01 17:42:33 +00:00
export let reqs = {};
export let advanced = false;
export let rating = 0;
2020-07-19 20:21:28 +00:00
2022-03-01 17:42:33 +00:00
const ship = getContext("ship") || {
dispatch: (...args) => console.log(args),
};
2020-07-19 20:21:28 +00:00
2022-03-01 17:42:33 +00:00
$: ship.dispatch("setEngine", { rating, advanced });
2020-07-19 20:21:28 +00:00
</script>
<style>
2022-03-01 17:42:33 +00:00
div {
2020-07-19 20:21:28 +00:00
display: flex;
align-items: end;
2022-03-01 17:42:33 +00:00
}
label {
font-family: var(--main-font-family);
margin-left: 2em;
}
input[type="number"] {
width: 5em;
}
2020-07-19 20:21:28 +00:00
</style>