feat: show name of fit next to the fit (#44)

This commit is contained in:
Patric Stout
2023-12-22 13:45:25 +01:00
committed by GitHub
parent 44137e0235
commit 53346708f7
2 changed files with 24 additions and 0 deletions

View File

@@ -7,6 +7,16 @@
width: 100%;
}
.fitName {
top: 35px;
position: absolute;
left: 0px;
}
.fitNameTitle {
font-weight: bold;
}
.cpuPg {
bottom: 0px;
position: absolute;

View File

@@ -2,6 +2,7 @@ import React from "react";
import { ShipFit } from "../ShipFit";
import { ShipAttribute } from "../ShipAttribute";
import { ShipSnapshotContext } from "../ShipSnapshotProvider";
import styles from "./ShipFitExtended.module.css";
@@ -50,6 +51,15 @@ const CpuPg = (props: { title: string, children: React.ReactNode }) => {
</>
}
const FitName = () => {
const shipSnapshot = React.useContext(ShipSnapshotContext);
return <>
<div className={styles.fitNameTitle}>Name</div>
<div className={styles.fitNameContent}>{shipSnapshot?.fit?.name}</div>
</>
}
/**
* Render a ship fit similar to how it is done in-game.
*
@@ -61,6 +71,10 @@ export const ShipFitExtended = () => {
return <div className={styles.fit}>
<ShipFit />
<div className={styles.fitName}>
<FitName />
</div>
<div className={styles.cargoHold}>
<CargoHold />
<DroneBay />