add carrier switch to Identification
This commit is contained in:
parent
3f6db25c99
commit
7cc85f2572
@ -8,10 +8,18 @@
|
|||||||
mass: 13,
|
mass: 13,
|
||||||
usedMass: 9,
|
usedMass: 9,
|
||||||
}}
|
}}
|
||||||
|
{api}
|
||||||
/>
|
/>
|
||||||
</Hst.Story>
|
</Hst.Story>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let Hst;
|
export let Hst;
|
||||||
|
import { logEvent } from "histoire/client";
|
||||||
import Identification from "./Identification.svelte";
|
import Identification from "./Identification.svelte";
|
||||||
|
|
||||||
|
const api = {
|
||||||
|
dispatch: {
|
||||||
|
setCarrier: (isCarrier) => logEvent("isCarrier", { isCarrier }),
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -10,6 +10,14 @@
|
|||||||
<label class="active">ship type</label>
|
<label class="active">ship type</label>
|
||||||
<i>arrow_drop_down</i>
|
<i>arrow_drop_down</i>
|
||||||
</Field>
|
</Field>
|
||||||
|
<label class="switch icon">
|
||||||
|
<div>carrier</div>
|
||||||
|
<input type="checkbox" bind:checked={isCarrier} />
|
||||||
|
<span>
|
||||||
|
<i>airplanemode_inactive</i>
|
||||||
|
<i>airplanemode_active</i>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<ShipCost {...reqs} />
|
<ShipCost {...reqs} />
|
||||||
</div>
|
</div>
|
||||||
@ -36,6 +44,9 @@
|
|||||||
shipType = shipTypes[0];
|
shipType = shipTypes[0];
|
||||||
|
|
||||||
$: api?.dispatch?.updateIdentification?.({ shipType, shipClass });
|
$: api?.dispatch?.updateIdentification?.({ shipType, shipClass });
|
||||||
|
|
||||||
|
$: console.log(isCarrier);
|
||||||
|
$: api?.dispatch.setCarrier?.(isCarrier);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -48,8 +59,18 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
}
|
}
|
||||||
|
select {
|
||||||
|
min-width: 10em;
|
||||||
|
}
|
||||||
|
|
||||||
.identification-row :global(> *:first-child) {
|
.identification-row :global(> *:first-child) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
label div {
|
||||||
|
font-size: var(--font-scale-10);
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
label.switch {
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
10
src/lib/components/ShipEdit/Identification.test.js
Normal file
10
src/lib/components/ShipEdit/Identification.test.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { render, fireEvent } from "@testing-library/svelte";
|
||||||
|
import "@testing-library/jest-dom";
|
||||||
|
import { tick } from "svelte";
|
||||||
|
|
||||||
|
import Identification from "./Identification.svelte";
|
||||||
|
|
||||||
|
test("carrier", () => {
|
||||||
|
const { getByLabelText } = render(Identification);
|
||||||
|
expect(getByLabelText("carrier")).toBeInTheDocument();
|
||||||
|
});
|
@ -1,8 +1,9 @@
|
|||||||
<Hst.Story>
|
<Hst.Story>
|
||||||
<Propulsion />
|
<Propulsion {api} />
|
||||||
</Hst.Story>
|
</Hst.Story>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export let Hst;
|
export let Hst;
|
||||||
|
|
||||||
import Propulsion from "./Propulsion.svelte";
|
import Propulsion from "./Propulsion.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user