.store-list {
display: flex;
text-align: left;
- margin: 0 0 0.3rem 0.3rem;
-}
-.store-list:last-child {
- margin-bottom: 0;
+ padding: 0.5rem;
}
-.store-list img {
- width: 64px;
- height: 64px;
+.store-list:nth-child(even) {
+ background-color: #f2f0ec;
}
.store-list .details {
padding: 0 0.4rem;
.store-list .name {
font-weight: bold;
}
+.requirements {
+ margin-top: 0.5rem;
+ line-height: 1.3rem;
+}
.requirement-title {
font-weight: bold;
text-transform: capitalize;
}
+.store-cost {
+ margin-top: 0.5rem;
+}
+.store-icon {
+ width: 64px;
+ height: calc(64px + 27px);
+ padding: 0;
+ background-repeat: no-repeat;
+ background-size: contain;
+ position: relative;
+ margin-right: 0.5rem;
+}
+.inventory-icon {
+ width: 64px;
+ height: 64px;;
+ padding: 0;
+ background-repeat: no-repeat;
+ background-size: contain;
+ position: relative;
+ margin-right: 0.5rem;
+}
.store-actions {
- width: 75px;
- margin: 0.3rem;
- align-items: center;
- display: flex;
- flex-direction: column;
+ width: 100%;
+ position: absolute;
+ bottom: 0;
}
.store-actions button {
- width: 75px;
+ width: 100%;
+ padding: 0.3rem 0.5rem;
+}
+.inventory-actions {
+ width: 74px;
+}
+.inventory-actions button {
+ width: 100%;
padding: 0.3rem 0.5rem;
}
function renderInventoryItem(item: EquippedItemDetails , action: (item: EquippedItemDetails) => string): string {
return `<div class="store-list">
- <div>
- <img src="${icon(item.icon)}">
+ <div class="inventory-icon" style="background-image: url('${icon(item.icon)}')">
</div>
<div class="details">
<div class="name">${item.name}</div>
</div>
${item.hasOwnProperty('id') ? `<div>${item.cost.toLocaleString()}G</div>` : ''}
</div>
- <div class="store-actions">
+ <div class="inventory-actions">
${action(item)}
</div>
</div>`;
function renderShopItem(item: (ShopItem & Item), action: (item: (ShopItem & Item)) => string): string {
return `<div class="store-list">
- <div>
- <img src="/assets/img/icons/items/${item.icon_name}" title="${item.name}">
+ <div class="store-icon">
+ <img src="/assets/img/icons/items/${item.icon_name}" title="${item.name}"><div class="store-actions">${action(item)}</div>
</div>
<div class="details">
<div class="name">${item.name}</div>
<div class="requirements">
${item.description}
</div>
- ${item.hasOwnProperty('id') ? `<div>${item.price_per_unit.toLocaleString()}G</div>` : ''}
- </div>
- <div class="store-actions">
- ${action(item)}
+ ${item.hasOwnProperty('id') ? `<div class="store-cost">${item.price_per_unit.toLocaleString()}G</div>` : ''}
</div>
</div>`;
}
${item.boosts.damage_mitigation ? renderStatBoost('MIT', item.boosts.damage_mitigation.toString())+'%' : ''}
${['WEAPON','SPELL'].includes(item.type) ? '' : renderStatBoost('AP', item.maxAp.toString())}
</div>
- ${item.hasOwnProperty('id') ? `<div>${item.cost.toLocaleString()}G</div>` : ''}
+ ${item.hasOwnProperty('id') ? `<div class="store-cost">${item.cost.toLocaleString()}G</div>` : ''}
</div>
`
function renderShopEquipment(item: ShopEquipment, action: (item: ShopEquipment) => string, player: Player): string {
return `<div class="store-list">
- <div>
- <img src="${item.icon ? `/assets/img/icons/equipment/${item.icon}` : 'https://via.placeholder.com/64x64'}">
+ <div class="store-icon" style="background-image: url('${item.icon ? `/assets/img/icons/equipment/${item.icon}` : 'https://via.placeholder.com/64x64'}')">
+ <div class="store-actions">${action(item)}</div>
</div>
${renderEquipmentDetails(item, player)}
- <div class="store-actions">
- ${action(item)}
- </div>
</div>`;
}