import type { Item } from "@proscenium/playbill"; import { capitalize } from "lodash-es"; import { Section } from "./base/section"; import { HTML } from "./base/html"; interface ItemSectionProps { item: Item; } export function ItemCard({ item }: ItemSectionProps) { let itemTypeDescriptor = ""; switch (item.type) { case "wielded": itemTypeDescriptor = `Wielded (${item.hands} ${item.hands === 1 ? "Hand" : "Hands"})`; break; case "worn": itemTypeDescriptor = `Worn (${item.slot})`; break; case "trinket": itemTypeDescriptor = "Trinket"; break; } const infoParts: React.ReactNode[] = []; if (item.affinity !== "none") { infoParts.push(

{item.affinity} Affinity

, ); } if (item.damage !== null && item.damage.amount > 0) { infoParts.push(

{item.damage.amount} {capitalize(item.damage.type)} Damage

, ); } return (
{infoParts}} rightCornerTag={capitalize(item.rarity)} leftCornerTag={itemTypeDescriptor} >
); }