Emit events when the user hovers over the card.
This commit is contained in:
parent
8ffffd8834
commit
b44417084c
1 changed files with 5 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import SciFiButton from "./SciFi-Button.svelte";
|
import SciFiButton from "./SciFi-Button.svelte";
|
||||||
|
import { createEventDispatcher } from "svelte";
|
||||||
import type { FuelCard } from "common";
|
import type { FuelCard } from "common";
|
||||||
|
|
||||||
export let hidden: boolean = false;
|
export let hidden: boolean = false;
|
||||||
|
|
@ -7,6 +8,8 @@ export let button: boolean = true;
|
||||||
export let buttonText: string = "Use Fuel Card";
|
export let buttonText: string = "Use Fuel Card";
|
||||||
export let card: FuelCard;
|
export let card: FuelCard;
|
||||||
|
|
||||||
|
const emit = createEventDispatcher();
|
||||||
|
|
||||||
let colour: string;
|
let colour: string;
|
||||||
let magnitudeShape = "";
|
let magnitudeShape = "";
|
||||||
if (card.type == "stationary") {
|
if (card.type == "stationary") {
|
||||||
|
|
@ -26,6 +29,8 @@ if (card.type == "stationary") {
|
||||||
<div
|
<div
|
||||||
class="card {hidden ? 'hidden' : ''}"
|
class="card {hidden ? 'hidden' : ''}"
|
||||||
style="--colour: {colour};"
|
style="--colour: {colour};"
|
||||||
|
on:mouseenter="{() => emit(`hover`, { card, visible: true })}"
|
||||||
|
on:mouseleave="{() => emit(`hover`, { card, visible: false })}"
|
||||||
>
|
>
|
||||||
{#if !hidden}
|
{#if !hidden}
|
||||||
<div class="magnitude {magnitudeShape}">
|
<div class="magnitude {magnitudeShape}">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue